If you need to register the built in category taxonomy for a custom post type you can do this by using the priority argument when adding an init action hook.
add_action( 'init', 'add_category_to_post_types', 11 );
function add_category_to_post_types() {
register_taxonomy_for_object_type( 'category', 'my_post_type' );
}
The third argument in the add_action()
call sets a priority so most things in wordpress will occur at the default priority of 10. By setting this to 11 your custom post type should be registered and the built in taxonomies will definitely be registered so you can add to your post type.
If that doesn’t work you need to check the priority of the action hook in which your post type is registered and set the number 11 above to something higher than that.
Related Posts:
- Allow member to have access to custom post type only. Permission to only edit their own posts
- add_rewrite_endpoint() not working for custom post type archives
- Pagination with custom post type not working
- WP_Query() show posts that end later than today
- Custom post type URL with post ID that allows archiving and paging
- How do i display the post type title?
- Sorting a query by custom field date
- custom post type archive page url to point to Page permalink
- WordPress Custom Post Type Category Page
- White screen error for a custom theme
- Custom post types – RSS lastBuildDate issue
- Determine which template-{slug}.php is being loaded
- How to remove/hide elements from the admin menu?
- disable /feed/ for custom post type
- Archive page for taxonomy of custom post type
- CPT tax slug conflict with post type slug
- $wpdb returns no results with SELECT query on custom post type, works on default post type
- Display Post Author for Custom Post Type in Edit-Post Screen
- Exclude current post when getting related post on custom post type and taxonomy
- Upload Image from Front End and Resize
- Multisite with a single, shared custom post type, while retaining site URL
- How to query different post types in specific order?
- How can I display my custom metaboxes on a custom post template?
- “Allow Comments” box cannot be checked
- How to specify URLS for custom posts & taxonomies
- Allow Administrator role access to custom capabilities [duplicate]
- Second Custom Post Type Archive
- Delete link on single-custom.php with redirection
- Creating Multiple Loops in Genesis, One Post then 20, each with custom fields
- Single Template for Custom Post Type stops working after WordPress 5.4 update
- wp_insert_post generates endless posts
- Wp_query: sort by PHP variable
- How can I make my custom posts appear in their assigned category url?
- WP_Query most viewed posts, in multiple Post Types, last 30 days, excluding a specific taxonomy term
- child of post type (custom)
- Rewrite rules for custom posts types
- Allow user to set custom order to a list of custom taxonomies?
- WordPress wrapped added a span tag to every single p tag
- How to Create Columns with WordPress and CPTUI display page ?
- Custom post type archive page blank
- Custom Widget WP_Query problem
- Dynamic Custom Fields
- Removed custom post type slug but not working for child pages
- Terms showing up in object cache on unrelated pages
- Show Custom Post Type meta boxes only on Page Edit
- using wp_update_post for updating custom post type
- How can meta boxes be added to “unknown” custom posts?
- Best way to specify “article type” in URL
- link to a random custom post while excluding current post
- Custon Content within WordPress Loop
- show all custom posts types in home page
- How to group navigation items in the admin panel
- Create Array from custom post type to display a slider
- Creating a website with EVENT post type and PAGES as subpages of those EVENTs
- Fix permission error for deleting custom post from front-end?
- Custom post type slug 404
- How to show list of taxonomy terms associated with specific post?
- Custom Post Type Field Array parsing [closed]
- How to use a specific custom field in a custom post type as slug
- Meta box not appearing in my custom post type
- Display Taxonomy Term Children in a Drop Down without Submit Button
- Help on Custom Post Types
- cannot achieve this structure (custom posts VS categories VS ??)
- Use conditionals with wp_enqueue_style to attach stylesheet according to post type displayed
- Custom Post Type Meta Box Text Input Field Won’t Save When Blank
- How add column from new table in Custom Post Listing (admin)
- Last post in loop – custom post types
- Adding Category Name in Slug in Custom Post Type
- Add Tags to a Custom Post Type from a FrontEnd Form
- Archive page of CPT’s custom Taxonomy
- Custom Post Type add_rewrite_rule
- Post type to appear on every page on site
- How to show related posts of category on post within custom posttype
- Saving custom JSON as custom post type
- Get custome post type name
- Custom search for a custom post type in WordPress
- Remove wp directory and slug for custom post type from the URLs
- WPML – Auto Duplicate Post Issue
- Loop carousel slider in wordpress
- How can I add a “fake” parent into the permalink?
- Best way to structure article and issue relationship for CPT
- How to display custom post types AND regular posts separately on a shared taxonomy archive?
- Custom Post Type used for FAQs Accordion
- Custom post types working in functions.php but not in plugin
- Change column of row action (Quick Edit) links in WP_List_Table
- Show list of categories in post editor only from current custom post type
- Custom Post Type Slug / Page Slug Conflict – Prevent use of reserved slug on page save?
- How do I add a checkbox option to this custom post type code?
- Comment moderation with disqus comments
- 404 on Pages for Custom Post Type & Query_Posts
- Classic Custom Post Types and WP-PageNavi
- Can I set a CPT title field to a dropdown with preset options if user is of a given type?
- List of filtered Events is breaking paging?
- Permalink of Custom Post Type
- Show one of the taxonomies always as default
- How can i manually relate pages?
- Pagination for Custom Post Type with Multiple Types
- From form submission values – dynamically update CPT “has_archive” slug and custom taxonomy “rewrite” slug value
- How to make a non-public post on wordpress approval?
- Quering array of post types & pagination. Articles are repeating sometimes on different pages