[wp-trac] [WordPress Trac] #35084: check for post status in get_page_uri causes issues with permalinks

WordPress Trac noreply at wordpress.org
Thu Dec 17 00:03:20 UTC 2015


#35084: check for post status in get_page_uri causes issues with permalinks
--------------------------------------+--------------------
 Reporter:  tharsheblows              |       Owner:
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  4.4.1
Component:  Permalinks                |     Version:  4.4
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+--------------------

Comment (by netweb):

 Replying to [comment:9 tharsheblows]:
 > I don't know where the `@since` would go because nothing has really been
 added. I think as long as you put `get_page_uri` in the visible part of
 the commit message it should be ok? Or I don't know, it would for me,
 that's usually how I find things.

 In the PHPDoc's is what I'm referring to, e.g:
 {{{
 #!diff
 Index: src/wp-includes/post.php
 ===================================================================
 --- src/wp-includes/post.php    (revision 35946)
 +++ src/wp-includes/post.php    (working copy)
 @@ -4286,6 +4286,8 @@
   * Sub pages will be in the "directory" under the parent page post name.
   *
   * @since 1.5.0
 + * @since 4.4.0 Do not add parent slugs to orphaned pages
 + * @since 4.4.1 Support custom post statuses
   *
   * @param WP_Post|object|int $page Page object or page ID.
   * @return string|false Page URI, false on error.
 @@ -4300,7 +4302,7 @@

         foreach ( $page->ancestors as $parent ) {
                 $parent = get_post( $parent );
 -               if ( 'publish' === $parent->post_status ) {
 +               if ( ! in_array( $parent->post_status, get_post_stati(
 array( 'internal' => true ) ) ) ){
                         $uri = $parent->post_name . '/' . $uri;
                 }
         }
 }}}

 I'm not sure if we do the minor version for our docs, i.e. the `4.4.1`
 line in this case

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


More information about the wp-trac mailing list