[wp-hackers] 'init' and 'wp' actions calls fail on functions.php

Vinicius Massuchetto viniciusandre at gmail.com
Fri May 21 21:02:37 UTC 2010


On Fri, May 21, 2010 at 10:02 AM, Austin Matzko <austin at ilfilosofo.com> wrote:
> On Fri, May 21, 2010 at 7:53 AM, Vinicius Massuchetto
> <viniciusandre at gmail.com> wrote:
>> Would be something like:
>>
>> add_action ( 'init', 'link_redirect' );
>>
>> function link_redirect () {
>>
>>        echo 'lala';
>>
>> /*      global $wp_query;
>>
>>        $id = $wp_query->post->ID;
>>
>>        if ( $url = get_post_meta( $id, 'redirect', true ))
>>
>>                wp_redirect($url);
>> */
>> }
>
> "init" is too soon for the post property of $wp_query to be populated.
>  You probably want "template_redirect" instead.

Sorry. I just changed that for testing echo 'lala'.
No results, yet.
--
Vinicius


More information about the wp-hackers mailing list