Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#14231 closed defect (bug) (invalid)

'custom post type' with the 'category' taxonomy - dont get the default category by saving whitout categories

Reported by: mati1000 Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: General Keywords: custom post type, default taxonomy
Focuses: Cc:


is expected that a 'custom post type' that I register with the built-in 'category' taxonomy - get Also the 'default category' by saving with non categories. Or alternatively the 'register_post_ type()' function are need to accept a 'default taxonomy' argument
if I set any taxonomy for this post type.

currently the wp_set_post_categories function checks:
if ( 'post' == $post_type....)

Change History (4)

comment:1 @nacin5 years ago

The main reason why we still have the default category requirement is that many themes rely on a post having at least one category. Otherwise, I imagine we would have tried to remove it a long time ago. So I imagine this code is the way it is to prevent the default category requirement from creeping into the codebase further than necessary.

comment:2 @mati10005 years ago

I understand , but I wrote a plugin that create a custom type "banner" and the banner is linked to the built-in 'category' taxonomy. the "plugin widget" query the banners - base on current query. now, I cant to filter in admin-edit-posts all banners that dont assigned to any category.

(sorry of my english)

comment:3 @dd325 years ago

Nacin's correct that the default category is enforced for back compat reasons, namly, that some themes expect there to be at least one category, as well as for Permalinks (As many people use %category% in their url's unfortunately)

Default Term's are not supported for other taxonomies, or post types.

If a plugin wishes for their taxonomy to recieve a default item for a post type, then the plugin should enforce that itself.

comment:4 @nacin5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.