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 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
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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'); ?>