[wp-trac] Re: [WordPress Trac] #4712: get_pages filter may be
applied twice
WordPress Trac
wp-trac at lists.automattic.com
Mon Oct 8 00:21:36 GMT 2007
#4712: get_pages filter may be applied twice
-----------------------+----------------------------------------------------
Reporter: DD32 | Owner: markjaquith
Type: defect | Status: reopened
Priority: normal | Milestone: 2.3
Component: Template | Version: 2.2
Severity: normal | Resolution:
Keywords: get_pages |
-----------------------+----------------------------------------------------
Changes (by epper):
* status: closed => reopened
* resolution: fixed =>
Comment:
If you have a plugin adding pages to the get_pages() function by the
'get_pages' filter AND the get_pages() function itself doesn't find any
page, the result should infact be only the pages added by the plugin via
the filter.
The problem is that with the change discussed in this ticket (and now live
in wordpress 2.3) this cannot appen because of these lines: (in wp 2.2
this was ok)
{{{
1187 if ( empty($pages) )
1188 return array();
}}}
On empty result set from the database, the empty result is returned and is
not filtered.
I don't really know wordpress code like you all but I think that this
simple patch could help to solve the problem:
{{{
1187 if ( empty($pages) )
1188 return apply_filters('get_pages',array(),$r);
}}}
With this change, my plugin, which allows to add private pages (with a
special parameter) to the wp_list_pages output, now works correctly.
--
Ticket URL: <http://trac.wordpress.org/ticket/4712#comment:4>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list