Instead of
if (is_admin())
add_action('admin_menu', 'add_custom_box');
use
add_action('add_meta_boxes', 'add_custom_box');
The ‘add_meta_boxes’ hook is the correct one to add meta boxes. Other than that, as you mentioned correctly change the ‘post’ to ‘$my-custom-post-type’ and register the category taxonomy for that post type:
register_taxonomy_for_object_type( 'category', '$my-custom-post-type' )
Related Posts:
- Add default WordPress tag meta box to User Profile
- Custom taxonomy hide meta box but show in menu
- How do you remove a Category-style (hierarchical) taxonomy metabox?
- Add description to custom taxonomy admin metabox
- Get the term id belonging to custom taxonomy on a custom single-post-type.php template page
- Automatically assign taxonomy term if custom meta value exists
- How can I conditionally change the title of a taxonomy meta box?
- How to Put Custom Taxanomy Meta Box in Main Column
- Metabox to list/store a certain type of post tag
- Autogenerate Front End Form Field With jQuery
- Adding content to a taxonomy metabox
- Controlling Taxonomy Category listings to hide and unhide specifics
- Render P2P metabox per taxonomy term
- Prevent users from adding taxonomy terms
- Create custom taxonomy and Display in metabox dropdown
- Separate tags with semicolon
- Why isn’t the ‘no results’ being shown when a query returns no results?
- Remove taxonomy widget from “PAGE” post
- Search box with field hidden till drop down selection is made
- unable to save custom taxonomy terms in a custom-built metabox in wp-admin
- Dropdown list of taxonomies won’t display selected
- Extra Meta Data for WordPress Multisite Taxonomy
- wordpress mysql / wpdb ajax load more for terms help
- Dropdown (with onChange) with custom taxonomies
- Remove Custom metabox from particular page template is used
- transfer two existing taxonomy terms into one custom metabox
- Searching JQuery arrays of taxonomy terms for word matches in frontend images upload
- Looking for suggestions on creating simple database (Help!!)
- Does a codex exist for creating meta boxes in taxonomy
- Attaching meta box to specific category/taxonomy in custom post type
- register_taxonomy – show in admin menu, but not on post type (edit) screen
- Taxonomy Extra Meta [duplicate]
- Nested Accordions For Taxonomies [closed]
- Modify Term List in Custom Taxonomy Meta Box
- get_the_term_list without links in 3.1
- Custom columns on edit-tags.php main page
- Creating a non-removable taxonomy term
- Is it possible to use one slug for Multiple Taxonomies?
- Is it possible to add taxonomies to user profiles?
- Get terms from multiple taxonomies
- get taxonomy terms for parent and child
- On Taxonomy Template page, want to add Post_Type
- Separator for multiple terms
- The next_posts_link() show me a aditional page in blank
- Help building array hierarchically with taxonomies (to get posts)
- What are terms and taxonomy, how they related to post and how these three are stored in database?
- Get multiple term objects by ids
- Echo custom taxonomy term name
- Next and Previous links on a single taxonomy page only link to same term
- Why does WP rename similar “term name”-slugs in separate taxonomies?
- validate a metabox based on the category that is selected
- Getting the selected terms for custom taxonomies in the editor
- Change permalink of post if it belongs to custom taxonomy
- Set custom post type terms by id without knowing taxonomy
- How to determine the depth of a term in a custom taxonomy?
- How do I Use Multiple Loops with WP_Query?
- $wpdb query a post type within a specific taxonomy term while ordering posts by custom meta value?
- How to add contents of a custom field to a taxonomy term list?
- Google Map Shortcode for Custom Taxonomy/Post Types
- Querying two taxonomies
- How to target parent product category and its children using WooCommerce?
- Custom taxonomy query is empty. 0 = 1 in SQL
- How do you reorder the custom taxonomies on the right side of a custom post edit page?
- Ordering values entered in Custom Taxonomies
- What is the most efficient way of implementing a notification system? [closed]
- Remove custom taxonomy column from my custom post type columns
- Check if custom taxonomy has posts with get_categories()
- How to add images to taxonomy terms? [duplicate]
- Echo custom taxonomy slug
- Remove a href from this code
- Adding a second custom taxonomy to a custom post type (both shown in its table)?
- Get post terms from multiple custom taxonomies
- How to get list of only custom taxonomies?
- Replicate Drupal form options as taxonomies?
- Listing only custom post types with two required categories?
- custom taxonomies label in hebrew
- Amend taxonomy to search in wordpress admin
- filter for thumbnail not working for custom taxonomy term
- Custom taxonomy only gets saved in quick edit
- Get tags name under custom taxonomy in wordpress
- Show message if term slug changed
- Get post meta value outside of the loop
- Unable to create a new taxonomy
- Code inside conditional is_tax() only working when term has posts
- Change link of taxonomy when get_the_term_list( is used?
- Get link for taxonomy to show top-level terms
- Invalid taxonomy with custom script
- Multi level archive
- How to add meta fields to custom taxonomy add/edit page?
- Passing a variable to register_taxonomy()
- Disable drag metaboxes, create many functions using js not to work!
- Broken paths on taxonomies after changing permalink to post name
- Toggle a metabox based on a selection
- Where to put a migration script to switch post information?
- Gravity prerender taxonomy [closed]
- One taxonomy template for all categories?
- Error in Custom Taxonomy UI
- Remove ‘portfolio’ from URL
- Complex Taxonomy scheme
- Display posts from specific slug of the custom taxonomy in WordPress