You can add button via add_meta_box function.
function add_your_meta_box(){
add_meta_box('your-metabox-id', 'Title', 'function_of_metabox', 'custom_post_type', 'side', 'high');}
add_action('add_meta_boxes', 'add_your_meta_box');
function function_of_metabox()
{?>
<input type="submit" class="button button-primary button-large" value="Add New" id="add-new"/>
<?php }
if you add to multiple post type, you should use foreach loop.
function add_your_meta_box(){
$types = array("post","page","custom_post_type");
foreach($types as $type){
add_meta_box('your-metabox-id', 'Title', 'function_of_metabox', $type, 'side', 'high');}
}
add_action('add_meta_boxes', 'add_your_meta_box');
Related Posts:
- call a function when insert and update a custom post type
- Hook for post and page load
- flush_rewrite_rules on save_post Does Not Work on First Post Save
- Why get_next_post_link() or get_previous_post_link() doesn’t return the required links?
- How often do you need to register_post_type?
- How to register custom post types in a plugin?
- Insert Multiple Post with Same Publish Button
- Why is conditionally loading a custom plugin’s code only on a specific custom post type causing the site content to disappear?
- wordpress remove views from action links in a custom post
- What’s an efficient way to change the post status of many posts at once?
- Add to ‘action’ within post.php to allow more actions when editing a Custom Post Type in a plugin
- Creating alternate meta box context locations
- Is it possible to get the specific content on the search page?
- Best way to fix bad count on All | Mine | Published
- Plugin Development using classes – Public & Private Callbacks
- Create a post automatically if search result has zero results
- Changing CPT permalink
- Correct way adding External classes to Custom Post type and output their methods to template
- Correct way to register custom post type from external php file?
- Widget area for individual posts (custom post type)?
- Execute code only after user clicks ‘update’ button for CPT being edited
- Adding Information To All Posts Screen
- Hook only specific post type
- How to change post cpt with submit button?
- Custom post type template not loading from plugin
- I am having a problem with fetching product data in the Gutenberg block editor
- Post URL redirecting to homepage
- button onclick with get_post_permalink
- Customize permalink when creating a post
- How to make post sticky in the admin page?
- get_template_part for custom post type content not working
- Custom Taxonomy Not Showing in Menu
- Remove All, Published and Trashed Post Views in Custom Post Type
- Custom Post Type | Fatal Error on register_post_type()
- Loop on front-page.php
- Set a default category – if the user didn’t select one- before creating a post
- Set object terms not working on plugin activation
- Custom Taxonomy – Tags Metabox is showing instead of Categories
- Why my custom post posts aren’t showing (404 error / page not found)
- Using custom page templates with plugin [duplicate]
- Automaticly add slug to posts
- need advice on how to do a lists using custom post types – taxonomy vs postmeta
- How to post twitter like updates on wordpress
- Show Two custom Post type and their posts on category page
- Can’t unregister parent theme’s CPT from my child theme
- WP_Query is printing out only one post when posts_per_page is set to multiple
- Trying to edit the single page from a Custom Post
- How to Submit Post Via cURL & PHP
- How to get all posts except for one post from a certain custom post type?
- count_many_users_posts except current logged in user?
- Get all of user’s custom post types in WP Admin for plugin
- Modifying date filter on admin page for custom post type to link to custom field
- How can I show a custom post type for users in the authors.php file?
- Issue with pre_get_posts on custom post type archive pages
- Blog page showing same content as homepage
- Custom Post Type Navigation on Custom Field
- apply filters only to specific post listing without check the url parameters
- How Can I Set the Post Author of a Post I Just Created With PHP?
- Custom post type and body_class: Remove “blog” class
- WordPress Orderby Numeric Value Not Working
- Plugin translation not working apart from name and description
- Get rewrite slug of custom post type in template
- Exclude child pages from archive.php
- is there a way to retrieve posts that do not have a featured image assigned?
- Auto-generated posts not showing in backend (but being counted!)
- Custom Post Type rewrite
- Shortcode for display posts on home page show only one post
- Deleting Custom Post type data using mySQL command
- Admin notice not displaying
- How to Get Current Custom Post Type Selected Taxonomy Term (Not All Terms)
- Find the user who initially created the post
- Custom Post Type: Upload Multiple Images
- Need help targeting a custom post type with conditional tags
- How to get the post type from a category id?
- Detect where custom post type is declared
- Notice: Undefined index: suppress_filters
- Metadata for a taxonomy – is there any WordPress way of doing this?
- How to Separate CPT From Regular Posts?
- Hooking in to an archive page?
- Remove rows in the manage post/page view
- Add custom column in custom post type edit page
- Is there a way to have the view link on manage posts page to open in a new window or tab?
- How to create custom boxes with text inside?
- How to add post_type=value when editing that post type in the WordPress admin?
- Hook to override title, image and content
- Adding dropdown select meta box to custom post type – seems restAPI is interfering
- Open Custom Post Type as PDF
- Using The REST API How To Pull All Custom Posts?
- Validate custom fields before save using WordPress Rest API
- How i can add ‘N’ page of ‘N’ pages under posts loop?
- get_object_taxonomies() returns empty array for custom post type
- How to: Display ACF [fields] on Custom Post Types Utilising WordPress ‘Hooks’? [closed]
- WordPress theme custom capabilities not works
- custom post type not showing in menu
- Custom posts don’t work
- Show the same Article Available in Other Categories
- Getting posts under the custom post type ui category
- No posts found – Custom Post Type show_ui
- Storing posts from query and accessing later via AJAX call
- If post has custom field then display css-class