[wp-hackers] Fooling Wordpress To Think Plugin Output Is A Page

Jordi Canals jordi at jcanals.cat
Sun Jan 24 19:00:37 UTC 2010


2010/1/24 Jordi Canals <jordi at jcanals.cat>

> 2010/1/24 Alex Andrews <awgandrews at gmail.com>
>
> The pages are too dynamic to be added to the database. Have you any idea
>> what would be filtered? As I said it seems there must be bits of wp_query
>> which correspond to the stuff that says 'this is a page called z'.
>>
>> Thanks again.
>>
>> Alex
>>
>>
> When I need to do that, I rely on the page ID, as the page title can be
> easily changed.
>
> Plug a function to 'the_content' filter and then, check the page ID:
>
> function my_page_content ( $content )
> {
>      if ( 5 != get_the_ID() ) return $content;
>
>     // Do your stuf here and modify the $content var if needed.
>
>     return $content;
> }
>
>
Forgot this:

add_filer('the_content', 'my_page_content');

-- 
Jordi Canals
http://alkivia.org - http://jcanals.cat


More information about the wp-hackers mailing list