Make WordPress Core

Opened 8 years ago

Closed 8 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)

#1 @nacin
8 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.

#2 @mati1000
8 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)

#3 @dd32
8 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.

#4 @nacin
8 years ago

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