[wp-trac] [WordPress Trac] #27094: get_boundary_post() doesn't work for custom post types

WordPress Trac noreply at wordpress.org
Tue Feb 11 14:59:07 UTC 2014


#27094: get_boundary_post() doesn't work for custom post types
--------------------------+-----------------------------
 Reporter:  PioneerSkies  |      Owner:
     Type:  enhancement   |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  3.8.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 [https://core.trac.wordpress.org/browser/tags/3.8.1/src/wp-includes/link-
 template.php#L1318 Here the function]

 I'd suggest a very little change in order to open use of the function to
 CPTs:


 {{{
 function custom_get_boundary_post( $in_same_term = false, $excluded_terms
 = '', $start = true, $taxonomy = 'category', $post_type = 'post' ) {

         $post = get_post();
         if ( ! $post || ! is_single() || is_attachment() || !
 taxonomy_exists( $taxonomy ) )
                 return null;

         $query_args = array(
                 'post_type' => $post_type,
                 'posts_per_page' => 1,
                 'order' => $start ? 'ASC' : 'DESC',
         );

 [snip]
 }}}

 The order of $taxonomy and $post_type arguments isn't ideal imho, but
 would be absolutely backward compatible.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27094>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list