Make WordPress Core

Opened 7 years ago

Closed 4 years ago

Last modified 4 years ago

#43516 closed enhancement (fixed)

Allowing default category to be applied to all CPT associated to 'category' taxonomy

Reported by: enricosorcinelli's profile enrico.sorcinelli Owned by: whyisjake's profile whyisjake
Milestone: 5.5 Priority: normal
Severity: normal Version: 5.1
Component: Taxonomy Keywords: has-unit-tests has-patch has-dev-note
Focuses: Cc:

Description

This patch allows to apply the default category term also for post types that have the category taxonomy, not only for post.

It's not a too remote case to register new post type and associate it also with the category taxonomy.
Currently in this case, the default_category option value is never applied.

I sent two patches. The first one apply the default category term to all post types associated with the category taxonomy.

If for legacy reason we don't want introduce any behaviour compatibility break - for example with third party plugins - I sent the second one that introduce a new default_category_post_types filter allowing to define for which post types (in addition to post) to set the default_category.

Attachments (4)

43516.default-category-all-cpt.patch (3.0 KB) - added by enrico.sorcinelli 7 years ago.
43516.default-category-filter-cpt.patch (3.7 KB) - added by enrico.sorcinelli 7 years ago.
43516.default-category-all-cpt.2.patch (3.0 KB) - added by enrico.sorcinelli 4 years ago.
43516.default-category-filter-cpt.2.patch (3.8 KB) - added by enrico.sorcinelli 4 years ago.

Download all attachments as: .zip

Change History (21)

#1 @enrico.sorcinelli
7 years ago

  • Keywords has-unit-tests has-patch added

#2 @SergeyBiryukov
6 years ago

  • Milestone changed from Awaiting Review to 5.0
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

This ticket was mentioned in Slack in #core by enrico.sorcinelli. View the logs.


6 years ago

#5 @pento
6 years ago

  • Milestone changed from 5.0 to 5.1

#6 @pento
6 years ago

  • Milestone changed from 5.1 to 5.2

#7 @desrosj
5 years ago

  • Milestone changed from 5.2 to 5.3

This ticket has not received any attention during the 5.2 cycle. With beta 1 tomorrow, going to punt this to 5.3.

#8 @davidbaumwald
5 years ago

@SergeyBiryukov Can this be reasonably included for version 5.3 Beta 1 tomorrow? If not, can we punt this to 5.4?

#9 @davidbaumwald
5 years ago

  • Milestone changed from 5.3 to Future Release

With version 5.3 Beta 1 releasing shortly, this enhancement is being punted to Future Release.

#10 @enrico.sorcinelli
4 years ago

I just refreshed patches (personally, I prefer the second one with the filter).
I hope the enhancement/fix will be added to 5.5 :-)

This ticket was mentioned in Slack in #core by enrico.sorcinelli. View the logs.


4 years ago

#12 @whyisjake
4 years ago

  • Milestone changed from Future Release to 5.5

#13 @whyisjake
4 years ago

  • Owner changed from SergeyBiryukov to whyisjake
  • Status changed from reviewing to accepted

#14 @SergeyBiryukov
4 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 48043:

Posts, Post Types: Introduce default_category_post_types filter.

The filter allows custom post types associated with the category taxonomy to opt in to requiring a default category, same as regular posts.

Props enrico.sorcinelli.
Fixes #43516.

#15 @desrosj
4 years ago

  • Keywords needs-dev-note added

Marking this to be called out in the miscellaneous developer focused changes dev note.

This ticket was mentioned in Slack in #core by helgatheviking. View the logs.


4 years ago

Note: See TracTickets for help on using tickets.