Here is a simple example that adds a meta box to all public post types:
// All public post types
$post_types = array_merge(
array('page' => 'page', 'post' => 'post'),
get_post_types(array('_builtin' => FALSE)),
);
// Add meta box for each post type
foreach ($post_types as $post_type)
{
add_meta_box('id', 'title', 'callback', $post_type);
}
WP Codex: get_post_types()
, add_meta_box()
.
Related Posts:
- How to get images from EDD post?
- Accessing post’s meta data based on user’s click of a post
- Creating a custom post type, adding custom meta fields, preventing all future editability of posts of this type
- Redirect to another page using contact form 7? [closed]
- How to delete all trashed item in one-go
- Finding the screen id of a page generated with add_menu_page
- WordPress custom taxonomy not showing
- 2 wordpress site same database
- “Allowed memory size” problem [closed]
- How to create repeater field manually, without plugin (ACF Pro)?
- How to Call Specific .PHP file on add_submenu_page selection in Plugin Development?
- How to get the custom field value using SQL query
- How to arrange custom posts in the backend/admin by custom taxonomy
- Problem with checked box on wp car manager plugin
- WordPress hide post from custom post-type on a single page
- Calling an custom field from theme option at the frontend
- WordPress User Frontend Editing Custom Fields
- public custom posts not showing in my wordpress plugin
- Tickera missing attendees – No attendees found
- How to fetch WordPress Gallery Images to a Custom Post Type?
- Remove H1 title in admin post edit screen
- From where come that JS files in ?
- Creating search filter through plugin
- How to append element after thumbnail
- Using spl_autoloading within WordPress plugin
- Loading class files via autoload method
- TechCrunch WP Asynchronous Tasks plugin still works on v4.7.5? [closed]
- allow arabic letters when register new account
- Plugin “Meta Box”: Implementing meta boxes in custom post type
- WP-Members redirect if member ALREADY logged in
- WordPress plugin installation
- Get image URL from media library in input
- Adding a custom line of text to php code
- How to get all events from ‘All in one Events calender’ plugin in JSON format?
- plugins_url() incorrectly returns a url with www subdomain
- Adding a post shortcode to a page template?
- Creating an Exit Confirmation Popup
- Difference between register_block_type & wp.blocks.registerBlockType
- How to redirect Old Post URL to new Post and keep Old post Comments?
- Way to hook into a sidebar call to replace it with a custom sidebar
- Escape special characters in image link
- Dashboard Widget Form
- Why Better WP security plugin returns 418 I’m a Teapot “error”?
- Modifying Footnote Plugin for Descriptive Title Attributes
- I would like to use create a function in my custom plugin to tell WP to use a different header
- New Plugin: Post update pushes a copy as a revision
- Frontend editing, Frontend user dashboard
- How to edit/delete single row items in a table on my own menu page
- Overide a function that is inside a plugin
- Plugin allowing for artists, events and venues
- Disable Other Plugins on my Custom Post Type?
- Uncaught Error: Call to undefined function get_user_by() after moving function from theme to plugin
- Getting media library popup in custom plugin admin page
- Sort products without thumbnail in WooCommerce shop page
- Create or Update thousands of woocommerce products via PHP
- cURL error 60: SSL certificate problem: unable to get local issuer certificate
- Can’t get custom posts of taxonomy to show
- How to add pagination to wpbakery grid?
- How to Replace Words with Hypertext Link But Ignore Previously Existed Links?
- send_headers don’t work on wordpress multisite
- Add multiple attributes to product from php
- Cannot run the code after I activate the plugin
- jQuery function didn’t work in my plugin
- Displaying admin notice dynamically
- Can I check plugins and themes for PHP 5.6 ahead of global PHP server Update
- bulk change of image setting “link to” to “link to: image url “
- Admin Dashboard with Custom Tab for Client
- custom taxonomy and custom post type url conflict
- Displaying Gravity Form data on WordPress page [closed]
- Improving a Stackoverflow “inspired” badge system to display badges in author page
- Get a list of galleries from an album in NextGEN Gallery [closed]
- How to install and activate a plugin via an external PHP script
- how to include a simple jquery file into a wordpress plugin
- Calling a plugin in theme development
- Display a text message if the field is not found and not if found
- Unable to activate wordpress importer after installing it
- Reposition Woocommerce Message
- Sanitizing, Validating and Escaping in WordPress (Plugin)
- Get total number of comment of the posts written by an author
- How do you remove plugin edit option?
- wordpress reusable content blocks
- Override plugin with functions.php
- Escape when echoed
- Scope for PHP Variables Assigned in functions.php or a plugin
- add_meta_box (Will display only in specific page admin WordPress)
- Make specific products accessible only to a user role in WooCommerce
- force customers to add only single item to card per purchase EDD [closed]
- Undefined property: WP_Post_Type::$ID
- Plugin exceeds memory limit
- How to get post URL in the_content filter?
- How to remove xmlns on language_attributes()?
- How to write one comment and publish on every post using database or plugin?
- GravityForm: Populate Dropdown with custom post type [closed]
- Add a plugin before main container
- Shortcode to generate and save password in a file
- How to get subscription key or id using Woocommerce Subscriptions [closed]
- How to get member list based on role by using buddypress?
- I don’t understand how this parameter works..?
- Why wp_mail() function isn’t sending any emails and displaying ‘0’ in Chrome ‘Network’ response
- How to initialize something in unit test before the init hook being called?