[wp-trac] [WordPress Trac] #36711: Add caching to get_page_by_path

WordPress Trac noreply at wordpress.org
Sun May 22 15:56:07 UTC 2016


#36711: Add caching to get_page_by_path
-------------------------------------------------+-------------------------
 Reporter:  spacedmonkey                         |       Owner:
     Type:  enhancement                          |  boonebgorges
 Priority:  normal                               |      Status:  reopened
Component:  Posts, Post Types                    |   Milestone:  4.6
 Severity:  normal                               |     Version:  2.1
 Keywords:  has-patch has-unit-tests dev-        |  Resolution:
  feedback                                       |     Focuses:
                                                 |  performance
-------------------------------------------------+-------------------------

Comment (by spacedmonkey):

 If doesn't require a test. get_page_by_path takes a $output param. The
 original function passes $output to get_post like so.

 {{{#!php
 if ( $foundid ) {
     return get_post( $foundid, $output );
 }
 }}}

 However currently, if the value returned from cache it doesn't pass the
 output param.

 {{{#!php
 } else {
    return get_post( $cached );
 }
 }}}

 This line should look like this
 {{{#!php
 } else {
    return get_post( $cached, $output );
 }
 }}}

 Currently if you run the function like this.

 {{{#!php
 $value = get_page_by_path( 'foo', ARRAY_A );
 }}}

 It would return an object.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36711#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list