开发者

Wordpress Widget Redirect Page

开发者 https://www.devze.com 2022-12-27 23:09 出处:网络
I already created a wordpress widget for adding some featured from admin panel.I need to redirect to another page from this widget.But,when i am try to use header() method which shows 开发者_Python百科

I already created a wordpress widget for adding some featured from admin panel.I need to redirect to another page from this widget.But,when i am try to use header() method which shows 开发者_Python百科a warning some thing like header already send by output....an do on.Is there any other method to redirect from wordpress widget?Please help me


There are several actions you could hook onto, most useful probably "init" or "widgets_init". Both are run before any output is printed, so you can redirect from those.

For a list of actions, see http://codex.wordpress.org/Plugin_API/Action_Reference

Example:

<?php add_action('widgets_init', 'my_redirect_function'); ?>
0

精彩评论

暂无评论...
验证码 换一张
取 消