Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Meta Box Only in CPT Edit Page, Not in Add New

Check the action of the current screen object for add:

function wpd_add_meta_box() {
    $screen = get_current_screen();
    if( 'add' != $screen->action ){
        add_meta_box(
            'myplugin_sectionid',
            'My meta box',
            'myplugin_meta_box_callback',
            'leads'
        );
    }
}
add_action( 'add_meta_boxes', 'wpd_add_meta_box' );

Related Posts:

  1. How do I remove all the metaboxes for a custom post type?
  2. Get all posts from custom post type and insert in select input as metabox
  3. Detect meta value changes when post is updated (post_updated)
  4. Having trouble with custom post type / meta box
  5. How can I include meta box content when searching?
  6. update a post meta from a single table cell TablePress
  7. update custom post type meta from a shortcode
  8. Custom Meta Boxes – Nonce Issue – Move to trash issue
  9. Displaying Meta Box Image
  10. How to keep a check box in custom meta box for custom post type checked by default for add new post?
  11. How to add multiple featured image in meta box in post editor?
  12. Show metabox in custom-post-template depending on taxonomy term?
  13. Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
  14. Displaying custom posts only if custom meta box’s date is not expired
  15. Displaying Metabox value (custom post type taxonomy)
  16. How can I display my custom metaboxes on a custom post template?
  17. get_post_meta is returning image id
  18. Populate Custom Fields in a Custom Post Type?
  19. Custom meta box data array: foreach not working correctly?
  20. Undefined Variable – Custom Post Type Meta
  21. Populate dropdown from one custom post type inside another custom post type
  22. How to check if user meta field is empty in conditional else statement
  23. A better way to add a meta box to custom post types
  24. Metabox not show in categories custom post type cmb2
  25. Show Custom Post Type meta boxes only on Page Edit
  26. Can’t publish custom post type – “You are not allowed to edit this post.”
  27. Meta Data for Custom Post Type not saving
  28. create custom meta box with default value
  29. Displaying a div from an assigned meta_value when on a page
  30. How to Echo Metadata Value in Currency Format
  31. Issue on Working with Metabox – Checkbox to enable Sale Items
  32. Why do I have to press the “Update” button twice to save my meta box values?
  33. Values from meta-box not on $_POST
  34. Custom post type suddenly stoped working after WordPress 5 update
  35. How can I output WPAlchemy repeating fields meta values in my page template?
  36. Meta box data is saved but NOT displayed in the meta box text field. Why?
  37. Save Metabox Custom Field Value
  38. Meta box data not saving
  39. WP_Meta_Query object with conditionals
  40. Related posts meta_query CPT
  41. Meta box with front-end styling
  42. Sanitaizing Select Optin For Custom Post Type Metabox in WP
  43. How to retrive Custom Post Type Meta Fields in Custom WP_Query
  44. Cannot Save MetaBox Data in Custom Post Type
  45. Add a class to post_class if more than one post shares same meta_value_num
  46. Function to return values from metabox
  47. Add a meta field to the list of results for a custom post type
  48. Empty meta-box returns publishdate if no value is set?
  49. Custom Meta Box with variable number of fields
  50. Custom Post Type meta data getting deleted on bulk editing taxonomies
  51. Get meta values from parent post and save in child post
  52. Metaboxes in Loop
  53. Custom meta box data not saving
  54. Collect custom post in a calendar
  55. Delete custom post type metadata without deleting the post in admin area
  56. Problem with ‘save_post’ hook not running
  57. Edit post meta direct from post.php?
  58. Howto: use existing post_meta as options for a different metabox (checkboxes or list)
  59. Display a post count from a custom metabox selection
  60. Post AND page parameter for WP function
  61. Use a Variable in update_post_meta as the $meta_key
  62. Using POST method in meta box, no results
  63. meta box on custom post type
  64. Checking if $_FILE isset for an array of file upload metaboxes
  65. Importing Data from a Non-WordPress database, into WP
  66. Ordering values entered in Custom Taxonomies
  67. Getting thumbnails of a custom posts featured images in a page-templates metabox
  68. Listing custom terms in custom post meta
  69. Permalinks: custom structure for taxonomy – tags?
  70. List Taxonomies: Don’t list taxonomy if it has no post – depending on custom post-meta?
  71. Custom Post Type & Meta Box – Displaying meta box information on front end?
  72. Remove Post Custom Meta Box
  73. How can I move (or create another) publish button?
  74. Wrap meta boxes & data handling for specific post types in classes?
  75. Can custom fields be added without a meta box?
  76. Meta Box on Custom Post Type not saving
  77. Custom fields for custom post type
  78. Show future events based on custom field AND order by date
  79. Custom “radio button meta box” not saving correctly
  80. Global custom meta box
  81. Sizing textarea field in custom metabox
  82. Moving meta boxes in admin
  83. Remove “show sharing buttons” metabox Jetpack from custom post type
  84. Using preg_replace to filter custom textarea
  85. Add additional field to custom post_type
  86. Meta-Boxes for CustomPostType cause PHP Errors and Notices in “Add New” view
  87. Custom Post Meta from custom metaboxes is randomly being deleted
  88. Check if post with same meta value exists
  89. Filter date from post meta when date is in string format
  90. Get only used meta_values
  91. If Post Meta Equals Current Title Conditional Advanced Custom Fields
  92. custom post type metaboxes not saving
  93. Add a custom meta box for client to order CPT posts how they want
  94. Is there a way to exclude posts based on meta_values?
  95. Save Multiple Metabox values
  96. Do posts, pages and / or custom post type objects have unique ID numbers or can there be multiple objects with the same IDs?
  97. Archieve.php not loading for custom post type
  98. Submitting Custom Post Types with custom fields from Front-end form
  99. Custom post type, have only my meta boxes
  100. Display Repeatable Meta Box Content
Categories custom-post-types Tags custom-post-types, metabox, post-meta
How can I get an array of all IDs from the current queried object?
How to structure a plugin into multiple files using classes?

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress