[wp-trac] [WordPress Trac] #12706: Custom post status bugs in the admin

WordPress Trac noreply at wordpress.org
Sun Jan 31 14:41:37 UTC 2016


#12706: Custom post status bugs in the admin
-------------------------------------------------+-------------------------
 Reporter:  ptahdunbar                           |       Owner:
     Type:  task (blessed)                       |      Status:  assigned
 Priority:  normal                               |   Milestone:  Future
Component:  Posts, Post Types                    |  Release
 Severity:  normal                               |     Version:  3.0
 Keywords:  has-patch westi-likes needs-testing  |  Resolution:
  needs-refresh needs-unit-tests editorial-flow  |     Focuses:
-------------------------------------------------+-------------------------

Comment (by helgatheviking):

 Replying to [comment:198 WebTechGlobal]:
 > I'm using 5 custom status for WTG Tasks Manager for a custom post type.
 >
 > Posts using a custom status do not show on the All posts view - the
 query must still have the original core statuses coded.


 Not sure if this was the original intent of this trac ticket, but I can
 confirm experiencing the same issue as WebTechGlobal.


 {{{
 register_post_status( 'active', array(
             'label'                     => _x( 'active', 'Status General
 Name', 'my-plugin' ),
             'label_count'               => _n_noop( 'Active (%s)',
 'Active (%s)', 'my-plugin' ),
             'public'                    => false,
             'show_in_admin_all_list'    => true,
             'show_in_admin_status_list' => true,
             'exclude_from_search'       => true,
         ) );
 }}}

 the `show_in_admin_all_list` parameter is either very misleading in its
 naming convention or buggy in its implementation, because setting this to
 `true` does ''not'' actually show posts of that `post_status` on the
 `edit.php?post_type=custom_post` screen. You have to filter the `request`
 variables and add the post statuses that way.


 {{{
 add_filter( 'request', 'my_request_query' );

 function my_request_query( $vars ) {
     global $typenow;

     if ( 'custom_post' === $typenow ) {

         // Status
         if ( ! isset( $vars['post_status'] ) ) {
             $vars['post_status'] = array( 'my-status-1', 'my-status-2' );
         }
     }

     return $vars;
 }
 }}}

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


More information about the wp-trac mailing list