Tag Info

Hot answers tagged

5

To display a metabox collapsed or closed by default, it is good to know that adding closed to it's class attribute will display it closed. All meta-boxes main divs that have closed in their classname, are displayed in the closed form. When the arrow is clicked it will be removed or added (toggled). This is done interactively on the post editor page. ...


5

Another way to do this is to use the hook in get_user_option: function closed_meta_boxes( $closed ) { if ( false === $closed ) $closed = array( 'submitdiv', 'postcustom', 'anothermetaboxid' ); return $closed; } add_filter( 'get_user_option_closedpostboxes_{post_type_slug}', 'closed_meta_boxes' );


2

Add a javascript to all admin pages: add_action( 'admin_print_scripts', 'auto_collapse_menu' ); function auto_collapse_menu(){ wp_enqueue_script( 'autocollapsemenu', plugins_url( 'autocollapsemenu.js', __FILE__ ), array( 'jquery' ), false, true ); } The javascript: jQuery(document).ready( function($){ // catch every click inside element with ...


1

You could hook onto the user register hook and apply the postbox state changes then, it would simply run whenever a new user is created. add_action( 'user_register', 'set_user_closedboxes' ); function set_user_closedboxes( $uid ) { update_user_meta( $uid, 'closedpostboxes_{type}',array('submitdiv','postcustom')); } Where {type} should be your ...


1

By default, Wordpress saves the open/close state of these metaboxes each time you toggle it. This is done via javascript, requesting an ajax endpoint on the server. You need to find out if that request is still send or not. If it's not send (e.g. javascript error, blocked by some plugin), then you found the cause. If it is send, you need to find out if the ...



Only top voted, non community-wiki answers of a minimum length are eligible