[wp-trac] [WordPress Trac] #16802: is_page() doesn't accept a full path

WordPress Trac noreply at wordpress.org
Mon Oct 7 14:43:59 UTC 2013


#16802: is_page() doesn't accept a full path
-------------------------+------------------------------
 Reporter:  johnbillion  |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Query        |     Version:  3.1
 Severity:  minor        |  Resolution:
 Keywords:  needs-patch  |
-------------------------+------------------------------

Comment (by Jesper800):

 I agree with Sergey Biryukov, `get_page_by_path` should be used for the
 approach suggested by Nacin. It runs a single query to fetch the ID,
 parent ID, slug and post type from the pages in the page path (exploded by
 `/`). After that, it checks the parts starting by the last child and
 moving up to the top ancestor.

 However, when running this with many page paths in the array parameter
 passed to `is_page`, this might actually be slower than the `get_page_uri`
 approach.

 I've patched this to use the `get_page_by_path`-approach (16802.2.patch).

 If this is accepted, it should also be implemented for `is_single`.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/16802#comment:11>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list