You can’t use the add_meta_box()
function with an array of post types unfortunately although it would be a good core contribution.
The way to do this at the moment is to get an array of your post types and loop over them calling your add_meta_box()
line for each one eg:
foreach( get_post_types() as $type ) {
add_meta_box( $id, $title, $callback, $type, $context, $priority, $callback_args );
}
You can filter the specific post types you get back if you need more control by passing an array into get_post_types()
with the post type criteria you want to match eg. 'public' => true
.
Related Posts:
- How to Add Custom Fields to a Custom Post Type?
- Do_Shortcode not working for Embed
- Display custom post type and custom fields within a Bootstrap Carousel
- how to filter by last name for custom post
- Search that will look in custom field, post title and post content
- clients list using wordpress
- Custom Taxonomy Template Post List with Sort Order
- Display Custom Post Type Fields
- How to do a custom bookmarks post type?
- How do I add media to a custom post type?
- Using new WP_Query in shortcode in a custom field causes the main post content to not display
- WordPress query by multiple Custom fields and order by date
- Using ‘strtotime’ function to convert a custom-meta-box to a date-stamp
- add_meta_box: Datepicker like the one for postdate?
- Custom field losing p tags on display
- Using posts and postmeta table to store custom Address Book Plugin data
- Bulk edit custom excerpt text in WordPress
- Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
- Getting a “Changes you made will be lost” dialog prompt on a custom post type page
- Frontend posting – everything saves other than checkboxes?
- Search Custom Post Type Custom Fields
- Saving repeated option values in a custom query
- Query Custom Post Types by date (custom field) range
- handling csv data with a custom post type
- How to remove slug metabox from custom post type’s page?
- Custom fields in Permalinks?
- query posts and custom post type with meta key
- Dynamically add / duplicate custom meta in custom post types
- Problem fields custom date, time, and checkbox
- Custom Post type and Custom Field WP_Query
- Adding Show Less/More link to Custom Post Meta
- Sorting custom post type columns with external data and without meta values
- Cannot add custom field to “orderby” parameter in Rest API
- Trash / Draft a WordPress custom post after custom date field expires
- Posting to a Custom Post Type from front end – user generated content
- Custom Meta Field – Remove comma from string with str_replace
- Tracking changes in admin-page so user gets warning when leaving the page
- Woocommerce custom field search in custom post type [closed]
- Filter custom post types by a field value
- How to Create a WordPress Plugin With Custom Post Type/Custom Field Features?
- How to integrate a form (Ninja Form or Contact Form 7) with Custom Post Types?
- First custom field value (out of several) displayed twice after query
- Multiple Frontend Filters Using Advanced Custom Fields
- Is it possible to activate customfield ‘text description’ upon activating the customfield ‘checkbox’?
- Custom Field values not Showing in Edit Page of Custom Post Type
- Add a custom meta box for client to order CPT posts how they want
- Create custom post with meta field with AJAX and the WordPress REST API
- create custom meta box with default value
- Add custom attributes to a post
- Custom Taxonomy Search result page
- Get post content from another section in custom single page
- Modify Posts from Custom_Post_Type within the plugin
- How to convert custom fields to content
- Increasing the default number of posts in custom post types
- Group by custom field value (start and end times)
- Variable Products as custom post types
- How to call a post’s metadata in shortcode.php?
- Ideas to connect external database table to wordpress posts as custom field source
- updating one custom meta field only
- Get post-meta value of all custom-posts – lowest to highest year-count?
- Confusion about how to use Custom Post Types, Custom Taxonomy or Category?
- Displaying Posts Using a Custom Query with a Custom Field and a term_id
- Create list from custom field comma separated values
- add_filter get array data before display in custom post_type
- Get previous and next custom post by custom field
- Having a repeating custom field in admin custom post type, what I’d go better with, for DB’s sake? ACF repeater or query a different post type?
- Create an user checklist system for a course plateform using ACF Pro and ACF Extended
- How to sort WP_Query by a custom text field (written as a date dd/mm/yyyy)
- Auto update publish date of CPT Post if default post custom field value match to cpt post CF Value
- WP Admin Dropdown List Filter for custom (ACF) field on custom post type(s)
- WP_Query get always custom post_type for first
- Post Click Redirect to Custom URL instead of Single Post Page
- wp_insert_post deleting previous post custom meta
- How can I add a meta[] to my custom post type and search by term with the Rest API?
- Show posts from WP Custom Post Type selected from a field in a metabox
- Query custom post type and custom field by URL parameters
- meta query multiple values for the same key
- Show Post columns to specific users on condition
- Custom post types – meta_query: search lesson which starts sooner
- Create Inclusions and exclusions
- Populate custom post type/custom fields from an external database
- Custom Field to post_title
- Automatically convert standard posts with custom fields to custom post types
- Importing URLs of Audio Enclosures
- Retrieving custom post type fields without a post
- Get month and day from a Date Picker custom field
- custom fields not showing before get_header
- pre_get_posts with multiple post types AND a meta_key
- Search form to find custom meta box generated data
- Custom Info Box at end of posts?
- Display Custom Post if custom field is marked
- predefined custom field on registration page
- Show Custom Post Type taxonomy term that matches custom field
- Query Distinct Taxonomies of Custom Post Type
- Select Menu for Custom post Type does not save
- loop through custom post-type with two meta_keys
- Allow authors to create article image
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- WP Query + custom fields: How to query event posts from the current date backwards 6 months and organize it month by month?
- Update Custom Field daily within 7days