It’s really easy, it’s called meta box and you can create one with the following code.
/**
* Register meta box(es).
*/
function plugin_prefix_register_meta_boxes() {
add_meta_box( 'meta-box-id', __( 'My Meta Box', 'textdomain' ), 'plugin_prefix_my_display_callback', 'custom_post_type' );
}
add_action( 'add_meta_boxes', 'plugin_prefix_register_meta_boxes' );
/**
* Meta box display callback.
*
* @param WP_Post $post Current post object.
*/
function plugin_prefix_my_display_callback( $post ) {
// Display code/markup goes here. Don't forget to include nonces!
}
/**
* Save meta box content.
*
* @param int $post_id Post ID
*/
function plugin_prefix_save_meta_box( $post_id ) {
// Save logic goes here. Don't forget to include nonce checks!
}
add_action( 'save_post', 'plugin_prefix_save_meta_box' );
Related Posts:
- Use a textarea for a custom post type
- How do I add a custom button to my “edit” list? ( edit.php?post_type= ) beside “Add New”
- Get all of user’s custom post types in WP Admin for plugin
- Admin notice not displaying
- Addition of custom option panel crashes Media Library & Admin Area
- WordPress custom post type capabilities issue
- Change Text in Admin Panel
- Restrict Custom Post Type to One Item
- Where, When, & How to Properly Flush Rewrite Rules Within the Scope of a Plugin?
- How can I remove the “Add New” button in my custom post type?
- How to Add Custom Taxonomy To Woocommerce Plugin
- Creating a Custom Post Type as a Plugin? Why?
- Quick edit screen customization
- Mini-Site Strategy
- Change the edit page for a custom post type?
- How do I filter the excerpt metabox description in admin?
- Is it OK to move admin menu items?
- WordPress Custom Post Type Admin Page really slow
- Post slug changed using code doesn’t reflect on editor when post is published
- WP Admin default view mode for Custom Post Type
- Render a different post/template from within the template_include action?
- Remove date and category filters when editing custom post types
- Custom Taxonomy and tax_query Issue?
- Custom Post Type Name Causing Problem
- How to register custom post types in a plugin?
- Actions that Run on Admin Edit Page Load After Posts Are Queried
- Custom role capabilities to administrator not taking effect (no plugin)
- How could I create a ‘private comments’ section on a custom post type?
- Need functionality with all post list available at edit.php
- How to remove ‘create new post’ entry for a custom post type?
- Issue with pre_get_posts on custom post type archive pages
- Custom Post Type + 20k posts = blank/404 within Admin edit.php [duplicate]
- Metadata for a taxonomy – is there any WordPress way of doing this?
- Remove rows in the manage post/page view
- get_object_taxonomies() returns empty array for custom post type
- Display post meta on edit page in admin
- Unable to get Custom Plugin Options data
- Add Custom Post type menu to another menu in specific location
- Filter hierarchical custom post type admin page by parent, and include children & grandchildren
- Custom post type editor with dynamic selects, one drop down populating a second second drop down not working
- WP-ADMIN – Listing all CPT in “posts” listing
- Custom Postype specific changes in admin panel
- custom comments form for custom post type
- Problems wp_insert_post and save_posts filter
- Add a custom text to admin footer in a Custom Post Type page
- wordpress remove views from action links in a custom post
- When should I create custom post types?
- Custom post type’s extra fields – how to handle?
- Send a conditional email notification when a custom field value changes in Post Type
- Getting 400 Bad Request on AJAX Call
- Set thumbnail and title for a post type archive (not post itself!)
- Show current custom taxonomy
- How to insert data into meta box from another plugin?
- WordPress: Custom User Role cannot access Custom Post Type | “Sorry, you are not allowed to access this page”
- Add to ‘action’ within post.php to allow more actions when editing a Custom Post Type in a plugin
- Add post type pages with plugin
- Custom capabilities not reflecting on admin panel
- How to List Custom Post Type Titles Based on Theirs Taxonomy Terms Inside a Nested Loop
- Most viewed post of custom post type
- Custom Attachment Type
- Is there a (preferable built-in) way to check what custom queries are used in a theme?
- Mandatory field in Custom post
- Custom post type page with parameter
- Hide title field of selected post-types on edit pages
- How to show the post which checkbox is not selected
- Replace Content of Sidebar on Custom Post Type
- How to upload an image to a custom post type
- Admin Post Table – Remove Title Edit Link
- I have a random letter appearing before my content. Where to start looking for the cause?
- How do I create a customised table list of a custom post type (in the admin area)?
- How to redirect from wp-admin/edit.php to a frontend page for specific custom post type?
- How to Use A Custom Post Type as Taxonomy for Another Custom Post Type
- Simple Data picker meta box
- Custom post meta box as a sub form
- Which File Populating CPTs in Slug URL
- Front End users account with lots of user Roles (not Woocommerce)
- How to reset HTML filter input fields on CPT list page?
- Foreach in get_post_types to apply a different filter per post type
- In WordPress do I create tables for my plugin or do I create custom post types for a Student and Classes Registration system?
- Display custom post type archive on page.php template
- get_post_types doesn’t work in plugin
- Show Templates in Custom Post Type Editor
- Render custom taxonomy query as single template
- How to avoid hardcoded text in a custom page template?
- How to use get_sidebar in plugin folder?
- Resources to learn OOP for WordPress plugins, custom post types, etc
- Show a custom field instead of username in the backend author area
- Can’t preview custom post – Redirected to home page
- Show posts of parent in edit.php
- How to create an upload page (front side)
- How to dynamically register custom post type
- How to change post cpt with submit button?
- How to separate posts by categories?
- Custom Post Type featured option
- Make term slugs of custom taxonomy available in WP REST API for custom post type?
- Change CPT Edit Target Link for Admin List
- How can I allow plugin users to define layouts for a custom post type
- REST API callback function is not called
- Query custom fields with three dates – start and end does not work
- Display posts of only a certain category in WP Admin section?