Remember Apple’s “Goto Fail”?
Similar situation:
Your code actually does this, when indentation is corrected:
foreach ( $post_types as $post_type )
remove_meta_box('trackbacksdiv', $post_type, 'normal');
remove_meta_box('postcustom', $post_type, 'normal');
remove_meta_box('authordiv', $post_type, 'normal');
remove_meta_box('postexcerpt', $post_type, 'normal');
So, it should does the job for trackbacksdiv
, but not for the rest because the function calls are outside of the foreach
and $post_type
is not defined.
If you replace $post_type
with post
it works, because..well, the function arguments are complete.
Wrap your foreach
in { }
and try it again.
Related Posts:
- Prevent sorting and dragging of specific postbox metabox
- Why can’t I hook into save_posts after admin_init?
- Why is `add_meta_box` not working?
- How to access global $wp_meta_boxes variable on front-end?
- prevent post submission
- Select box saves but doesn’t update value in admin
- Resetting admin post form on JS validation fail
- How to prevent further updates of custom meta when using actions to set one meta based on another
- Add custom action in post type
- How to position user meta data field
- meta box on new admin page
- Why do Metabox use Nonces?
- save_post_{$post->post_type} action firing on second save
- Remove meta box except on category pages
- WP admin display custom field if another field value is “Female”
- Error showing in current page id in wordpress admin
- Remove menu item dashboard for a unique user
- Hooking into the Meta Boxes (Name/Web Address/Description) on the ‘Add New Link’ Page
- How to set default screen options?
- Does WordPress have a “Form API”?
- Remove unusable metaboxes in nav menu management screen
- Hiding a theme’s meta box
- Admin account only shows Profile and Dashboard with no activity
- enqueuing React script and hooking its target div fails to load script
- Getting jQuery sortable items in custom metabox
- Why adding Categories does not auto refresh in Backend while using my custom theme?
- How to Change the Title of a Meta Box on a Specified Custom Post Type? [duplicate]
- Custom Metabox with Ajax in Edit Post – Stuck
- make a excerpt on data from a meta box?
- How to put Periods and Spaces for Array Values (Meta Key)
- How to verify meta box is registered in Unit Testing?
- Stop loading “collaborators” users on add new post or page?
- Add_meta_box not appearing, but does appear in screen options
- Change the post date from a meta box
- update_post_meta and get_post_meta not working
- Admin Panel – Custom Menu Sub-Item LINK
- Repeatable custom meta fields
- Get all meta boxes values
- special characters after saving draft interpreted as �
- Metabox saves on Update or Publish, but not on Saving Draft
- Checkbox on a meta box using CMB2 Plugin
- Decide Metabox Configurations for All Users
- metabox select – frontend display
- Set default post author to none on new post
- Automatically exclude categories from metabox based on title
- Add column to pages table
- how to save and get selected item id list with add_meta_box
- Remove anchor tag from meta box link
- Creating A New Admin Menu Tab For Theme Options
- cannot grab post meta from extended Walker_Category class properly
- How do you List all Sidebars in a Metabox
- Create more Meta Boxes as needed
- Add menu page issues (permissions & position)
- Removing Dashboard Menu Items Through The Database
- Add a meta box to ALL Pages
- How can i use this meta box function in my template ? (WordPress)
- load-{$page hook} and returned parameter
- Use remove_meta_box conditionally on custom post type
- How to remove some metaboxes for CPTs?
- How to add metabox ONLY to specific WooCommerce product type [closed]
- Add metabox without the container
- Making Comments, a sub_menu in admin menu
- wpalchemi metabox doesn’t show value from my post type
- HTML Table creator in metabox to put into post theme
- Display stored value in Meta Box
- How to use Gutenberg in CMB2?
- How to check specific value in two metabox?
- Trying to write a function in an external php file to manage admin menu visibility
- How can i get multi checkboxes value in metbox?
- Understanding WordPress’ post type support
- save radio button selection in post-meta on submit
- ShortCut on meta boxes
- Post edit screen: How to check if meta_box is registered?
- How to ‘clone’ select metabox options with a callback function? [closed]
- WordPress Admin Panel Left Sidebar No showing on Post create page
- Saving multiple fields (dropdown and text) in custom metabox
- save meta data of custom post type: WP_Error has no effect, even if insufficient capabilities
- display all registered meta boxes
- where can i see the registered new field for posts using register_meta() ?
- update_post_meta doesn’t work
- adding existing menu page on new customer user role
- Issue with search form admin panel after PHP migration
- Custom comment action
- Plugin dev: How to multiply instances of a plugin in the same metabox?
- do action inside a class is not working
- Ridiculous problem with CDATA [duplicate]
- Adding to an array & passing it through do_action/apply_filters
- Can’t save drop down select date in meta boxes
- WordPress check if value equals and echo “checked”
- Custom metabox for file upload return empty filename
- Video slideshow
- Meta Box Value not saving / populating?
- How to set default screen options?
- Reload meta box content with AJAX
- why esc_url not working in smartmetabox
- Change Default Custom Fields Metabox Name on cctm plugin
- Form submit from modal window to parent window
- jQuery datepicker not showing on admin menu
- How to change wp-admin and wp-login urls
- Submitting form to admin-post.php WordPress