[wp-hackers] Modifying wp_list_pages() from a plugin

Jeremy Clarke jer at simianuprising.com
Wed Jan 12 22:14:05 UTC 2011


On Wed, Jan 5, 2011 at 6:28 PM, Pete Holiday <pete.holiday at gmail.com> wrote:

> The wp_list_pages filter is applied to the HTML after it's generated, which
> would require me to a) query MySQL to see if the user has any private pages
> to display, b) parse the HTML to determine the format, c) insert the
> appropriate HTML in the right place. If that's the only solution, I suppose
> that's better than nothing, but I'm not sure how reliably the HTML could
> really be parsed into the values passed into the method.
>
>
I just checked and it seems like wp_list_pages calls get_pages(), which lets
you filter the results before returning:

    $pages = apply_filters('get_pages', $pages, $r);

Wouldn't that be the right filter for you?

-- 
Jeremy Clarke
Code and Design • globalvoicesonline.org


More information about the wp-hackers mailing list