Display metaboxes if checkbox ir marked

Why don’t you use only one metabox and then use jQuery to manage what options to show: // add metabox function adding_custom_meta_boxes( $post_type, $post ) { add_meta_box( ‘my-meta-box’, __( ‘My Meta Box’ ), ‘render_my_meta_box’, ‘post’, ‘normal’, ‘default’ ); } add_action( ‘add_meta_boxes’, ‘adding_custom_meta_boxes’, 10, 2 ); // render metabox function render_my_meta_box( $post ) { wp_nonce_field( ‘my_metas_nonce’, … Read more

Remove taxonomy widget from “PAGE” post

In your register_taxonomy() args, set meta_box_cb => false ‘meta_box_cb’ (bool|callable) Provide a callback function for the meta box display. If not set, post_categories_meta_box() is used for hierarchical taxonomies, and post_tags_meta_box() is used for non-hierarchical. If false, no meta box is shown. $args = array( //other args ‘meta_box_cb’ => false, ); register_taxonomy( $args );

Dashboard : remove Safari navigator message

According to that page: http://wpcodesnippet.com/hide-browser-upgrade-warning-wordpress/ You can put this code into your functions.php to get rid of that notices: // hide browser upgrade warning in wordpress function wcs_disable_browser_upgrade_warning() { remove_meta_box( ‘dashboard_browser_nag’, ‘dashboard’, ‘normal’ ); } add_action( ‘wp_dashboard_setup’, ‘wcs_disable_browser_upgrade_warning’ ); I would tell your client the risks that might be comming with this – just to … Read more

How do I enable “metaboxes” by default in menu editor?

The initial nav menu metaboxes are $initial_meta_boxes = array( ‘add-post-type-page’, ‘add-post-type-post’, ‘add-custom-links’, ‘add-category’ ); They register after first time user enter the menus section. So you can register them first after you create a new user. The function wp_initial_nav_menu_meta_boxes() is setting the user_option metaboxhidden_nav-menus with array of the hidden metaboxes. And if the user_option already … Read more

Cannot remove meta box added through OOP

Well, the function remove_meta_box is meant to handle only the UI part, it only removes the metabox from the screen. If you want to also delete the post metadata for that specific key you will need to use delete_post_meta function.

create metabox to activate slider

Don’t bother with the checkbox and metabox, that’s limiting: You’re only able to have a single slider, and have to add code for every new slider to add a new checkbox Data gets stored in post meta as a custom field, but querying posts by their post meta is super expensive and slow So I … Read more