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

WordPress Trac noreply at wordpress.org
Wed Feb 12 10:48:29 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        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by SergeyBiryukov):

 A workaround:
 {{{
 function set_post_type_for_get_boundary_post_27094( $query ) {
         $query->set( 'post_type', 'page' );
 }

 ...

 add_action( 'pre_get_posts', 'set_post_type_for_get_boundary_post_27094'
 );
 $post = get_boundary_post();
 remove_action( 'pre_get_posts',
 'set_post_type_for_get_boundary_post_27094' );
 }}}

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


More information about the wp-trac mailing list