You could try this:
get the ID’s of the attached categories and wrap your add_meta_box function inside a simple test against your defined cat ID.
add_action('add_meta_boxes', 'is_in_cat_example');
function is_in_cat_example() {
global $post;
$category = '5'; // can be an array of ID's as well
if ( in_category( $category, $post ) ) {
add_meta_box(...);
}
}
Related Posts:
- add_action hook for completely new post?
- Get List of Registered Meta Boxes and Removing Them
- How to add tab which is visible only in admin side of product in woocommerce? [closed]
- Dashboard like meta boxes in my plugin – how to save their position and open/closed state?
- Save metabox with multiple checkbox array
- How to Use WordPress Color Picker API in Custom Post Type Metabox
- How can i list current author’s categories?
- How to Make a Category Always Selected?
- How to create Image gallery Metabox in wordpress [closed]
- anything like add_meta_box for categories?
- Calling clean_term_cache() fails when called in the same plugin that creates terms, succeeds when called separately?
- Missing “category_children” option when dynamically creating categories via a plugin
- Conflicting save_post functions when passing the post id and saving custom meta boxes for different post types
- Can we create a category list page in WordPress?
- How to add meta boxes to the ‘Add new post’ screen?
- Rearranging Dashboard meta boxes with use of plugin/functions.php
- Plugin admin page meta_box toggle and order state not saving
- prevent post to have multiple categories in my plugin
- Metabox Not Showing on Custom Post Type But On Pages and Post
- Best choice of options/settings framework for plugin/theme development
- Admin auto-refresh is interfering with Firebug — how to prevent it?
- Which are the hooks run before/after when a category’s deletion?
- how do you prevent showing a particular category on the admin dashboard for specific user roles?
- update post meta for checkbox in the admin when inserted in the front-end
- Is it possible to change a term slug before being saved to the database?
- Custom Taxonomy to dropdown box on adminside wordpress
- wp_insert_category() setting the ‘cat_ID’ gives not array error
- Create & Save multiple Meta-boxes
- Add a Save Button to Custom Meta Box [duplicate]
- Dashboard – get status and position of metaboxes and pass them to ajax method
- Getting List of all registered Dashboard Widgets
- Send push when new post is published in a certain category
- what is the difference between these phares?
- How to get Metabox custom field to show checked if value is updated using post meta query?
- How do I update a field of a meta box?
- Input value from metabox is not found in $_POST after post save
- How do I get the sub categories of the parent when in a sub category?
- Including comments meta box on a plugin page
- Filter Categories widget to allow custom sorting?
- How to add a widget to the post editing view?
- Function/Class to list categories with checkboxes
- Adding admin menus to wordpress
- Automating the process of shortcode generation in a plugin – how is it done?
- Meta box on options page save form problem
- How can I show posts for a single category?
- Check if post belongs to any category
- Moving/dragging a metabox removes TinyMCE’s content
- Store custom meta box data as serialized array
- WP nonce field checkbox prints checked=’checked’ outside input field
- How to display the categories on page using shortcode?
- How to display the category id along with category name on categories list?
- add_action pre_term_description vs. pre_category_description
- How to add custom post widgets as tags into wordpress
- How to show parents of current page category, excluding the category?
- WP Dropdown Categories, display subcategories but not grandchildren categories?
- Any way to update_post_meta with html content? It gets stripped and becomes empty
- Load stylesheet in edit category page?
- How to relate the Category to user?
- Adjust query on single
- How to exclude categories from get_categories() select list inside a widget admin panel
- How to Show Category List With Corresponding Links?
- Can I attach a plugin via my add_filter callback contents?
- Metabox is not displaying
- Catch metabox values in Plugin
- Exclude Woocommerce Product Category From Sitemap
- want to show CMB2 metabox on woocommerce product data tab
- Why is $_POST empty when saving custom Meta Box?
- WP_List_Table Inside Metabox With Bulk Actions Not Working on Submit
- How to show only the last two categories in a menu?
- Determine if term is Category or Tag
- How to check category name available or not
- Save meta box data from selected dropdown list in bbpress reply form
- Metabox types list
- delete category on plugin deactivation wordpress
- Post is uncatagorized in publish_post action
- WordPress Filesystem create CSS-File – get Shortcode ID for Name
- Hide post by ‘post_category’
- How to save multiple values in custom post type from front end to back end
- Woocommerce product not appearing in category list page when created programatically [closed]
- add_meta_box does not display meta box in Admin
- Add WordPress Meta Box saved form input to WordPress RSS feed [duplicate]
- Yoast and another plugin
- set a custom post type to a taxonomy term programmatically in metabox
- Dynamically getting tags in post edit screen
- Making Woocommerce optimized for more than 500k products
- Add a new tag based on the category name in the publish event
- How to show metabox just in post.php in admin?
- Plugin dev: How to multiply instances of a plugin in the same metabox?
- Creating an archive page listing external data
- save_post not called in plugin / custom field still saving overwriting metaboxes
- Get fields of a widget
- Display Data’s metabox in page
- Show Metabox Images in slideshow instead of static
- How can i call from custom fields to the category editor?
- How to set/change another post author by custom fields or something else?
- What method would I use to show an image in between X amount of posts on category archive? [duplicate]
- filter on get_posts efficiently
- How to get recent one post from each category on home page?
- Saving metabox updates causing fatal error
- Plugin Localization