• Hi.
    When editing a page/post, then it should be possible to collapse the Members meta box after collapsing it. However, it keeps opening when entering/reloading the edit page.
    Thanks a bunch ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Vayu Robins

    (@vayu)

    I have found these two filters, that can be used to keep post meta boxes closed by default. However, this works for Yoast SEO because the $box_id = wpseo_meta is available, but there is no $box_id for this plugin?

    
    add_filter( 'get_user_option_closedpostboxes_page', function( $closed, $option, $user ) {
    	
    	$closed[] = 'wpseo_meta';
    	
    	return $closed;
    	
    }, 10, 3 );
    
    // OR with this filter
    
    add_filter( "postbox_classes_page_wpseo_meta", function( $classes ) {
    	
    	$classes[] = 'closed';
    	return $classes;
    	
    }, 10, 1 );

    They will work on pages only here, but can be on posts or cpt by switching screen_id and box_id postbox_classes_{$screen_id}_{$box_id} and get_user_option_closedpostboxes_{$screen_id}

    • This reply was modified 3 years, 5 months ago by Vayu Robins.
    Plugin Author Caseproof

    (@caseproof)

    Hi @vayu

    The ID of the meta box is members-cp, so can try to use this in your code and see if that helps?

    Best

    Thread Starter Vayu Robins

    (@vayu)

    Thanks @caseproof!
    This works:

    add_filter( 'get_user_option_closedpostboxes_page', function( $closed, $option, $user ) {
    	
    	$closed[] = 'members-cp'; // Members plugin
    	
    	return $closed;
    	
    }, 10, 3 );
    
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Keep Meta box collapsed’ is closed to new replies.