BUG REPORT: Metabox AIO update causes "Draft" labels to vanish for all posts

Support MB Builder BUG REPORT: Metabox AIO update causes "Draft" labels to vanish for all posts

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #48867
    Lucid ReverieLucid Reverie
    Participant

    Updating to the new 3.0.1 version of Metabox AIO introduces a new version of the builder that includes nifty status toggles for internal metabox post types.

    File: wp-content/plugins/meta-box-aio/vendor/meta-box/meta-box-builder/src/ToggleStatusColumn.php

    Unfortunately the code hides the draft status for all post-types, not just the ones that are listed. See below:

    
    class ToggleStatusColumn {
    	private $post_types = [ 'meta-box', 'mb-settings-page', 'mb-relationship', 'mb-post-type', 'mb-taxonomy', 'mb-views'];
    
    	public function __construct() {
    		foreach ( $this->post_types as $post_type ) {
    			// Priority 20 to ensure the column is added after other columns are added (like in views).
    			add_filter( 'manage_' . $post_type . '_posts_columns', [ $this, 'add_column' ], 20 );
    			add_action( 'manage_' . $post_type . '_posts_custom_column', [ $this, 'show_column' ], 10, 2 );
    		}
    		add_action( 'admin_print_styles-edit.php', [ $this, 'enqueue_scripts' ] );
    		add_action( 'wp_ajax_mbb_toggle_status', [ $this, 'handle_toggle_status' ] );
    
    		add_filter( 'display_post_states', [ $this, 'remove_draft_state_label' ], 10, 2 ); //<--THIS LINE NEEDED TO BE COMMENTED OUT TO RESOLVE THIS FOR ME
    	}
    

    Will this be addressed in a future update?

    I did discover that you can add your own custom post types to the $post-types array, and it will add that status toggle to the admin list for that post type as well. It would be cool if that was an exposed option in the custom post type settings, since switching posts between published and draft states is a fairly common use case.

    #48875
    PeterPeter
    Moderator

    Hello,

    Thank you for your feedback.

    This code causes the issue with the Draft status label for other post types

    add_filter( 'display_post_states', [ $this, 'remove_draft_state_label' ], 10, 2 );

    You can temporarily remove it to fix the issue. I'm going to escalate this issue to the development team to fix it in the next update of Meta Box plugins and support a filter hook so you can add other post types to the list of $post_types and show the toggle draft columns for those post types.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.