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
- Remove H1 title in admin post edit screen
- How to make simply “report” button on posts
- Jetpack plugin (ShareDaddy): Prevent share buttons showing on custom post types?
- Change destination author link
- How can I include PHP-Code to my post?
- how to display all posts Custom fields dynamically?
- shortcode doesn’t work
- [Plugin: Posts 2 Posts] reciprocal connections
- Setting up widgets in wordpress with a unique ID for the after_title argument
- post expire after x days
- How to get all events from ‘All in one Events calender’ plugin in JSON format?
- cURL error 60: SSL certificate problem: unable to get local issuer certificate
- How to Replace Words with Hypertext Link But Ignore Previously Existed Links?
- Make specific products accessible only to a user role in WooCommerce
- GravityForm: Populate Dropdown with custom post type [closed]
- Custom form action to handle data inside a plugin
- WP Post Template – Templates in own folder
- Apple push notification doesn’t work
- List taxonomy terms for post as checkboxes
- Override Plugin Script Fucnction in WordPress
- Conditional attributes and logic per product category
- Subdomains with almost the same content
- WordPress 4.8.1 php getting commented
- ACF: post query, hide duplicate values [closed]
- Issue running db create table query from static method
- Allowing users to Sign-up > Login > Post articles that need approval
- Use $variable from file1.php in file2.php (different file paths)
- Adding custom meta boxes to specified custom post type
- How do I make reusable content blocks for header and footer when using WordPress headless with another front-end?
- How to include a custom field in the woocommerce email?
- All custom widgets are not showing in widget area at the same time
- Adding a simple Javascript file with a plugin
- How to add/change (woocommerce) product tab icon
- Wierd site output [closed]
- How to write to a separate PHP file in plugin settings
- How can I store data from custom fields to custom tables?
- Custom post type change excerpt more and excerpt length
- Dynamic Image Replacement through call rail phone call tracking plugins in wordpress
- How can I show registration form inside modal?
- Order posts of a custom post type by the event date using FT Calendar Plugin
- How to display results from a data table with an encrypted user id?
- hardcoded wp pages/plugins problems
- Checkbox show / hide output result
- Need to edit author permissions | custom taxonomy
- Custom Logo Link WordPress
- Is it possible to pin a post in second position from top
- Attempting to list all product categories and the price range of all products within them
- WP Import All Multiple Dynamic Link Imports
- admin_notices show after load completed
- Error in Fetching Custom Post Type parent Category URL (slug)
- Creating an array from form inputs before it is posted to the options database
- Plugin which unlock free gift when you reach some amount in cart
- is there a way to display product gallery images via cdn
- How to assign a specific service to a specific provider based on location
- How can I create a secure file download in WordPress?
- how to convert frontpage.php to dynamic page?
- How can I see $post object in frontend from functions.php?
- Move plugin pages from dashboard to front-end
- 500 Internal server error wp_handle_upload_prefilter
- Ajax call to php function doesn’t work PHP code
- How can I make the search bar in my wordpress site search all of the pages rather than just the blog posts?
- WordPress PHP error getting posts from another wordpress blog
- How to insert image into the Settings Page of a Plugin?
- Paginated Comments “reply” does not work!
- How to limit each front-end user to view just his own uploaded files on Amazon S3?
- How to Fix WordPress 500 Internal server error due to custom post type
- I created a custom form in HTML/CSS and now I need it to submit … should I create custom PHP or is there a plugin I can use?
- Hide some portion on single.php base on author
- Displaying image from a repeatable group
- AJAX doesn’t pass variables to the php function in the plugin
- How to add a handler for a button in plugin?
- Is a custom post type considred a plugin?
- Move related products after product summary? [closed]
- wordpress select multiple options and illegal string offset ‘timeslot’ [closed]
- post_exists() returns a 0 but the 0 doesn’t register [closed]
- Woocommerce disable checkout on specific day
- How to debug periodic performance issue
- Foreach retun in shortcode
- How to register a template in [NEW] WordPress site editor through a plugin
- Can I send a body using wp_remote_get()?
- Call to undefined function create_function() – PHP 8.2