WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 2 years ago

#17584 new enhancement

Add post_type_supports filter

Reported by: mitchoyoshitaka Owned by: mitchoyoshitaka
Milestone: Awaiting Review Priority: normal
Severity: trivial Version:
Component: Posts, Post Types Keywords: has-patch
Focuses: Cc:

Description

The post_type_supports return value should be filter-able, and there's even a @todo in the code to that effect.

Attachments (1)

17584.diff (734 bytes) - added by mitchoyoshitaka 4 years ago.
Patch v2, passing all args using array_slice

Download all attachments as: .zip

Change History (7)

comment:1 @nacin4 years ago

I'm thinking that $args as in array_slice( func_get_args(), 2 ); should get passed along. That can be quite helpful. As an example, we use it for post thumbnails by post type. We can also remove the otherwise commented code.

comment:2 follow-up: @scribu4 years ago

Couldn't the same effect be achieved by using add_post_type_support() and remove_post_type_support() ?

There's no filter on current_theme_supports() either.

comment:3 in reply to: ↑ 2 @mitchoyoshitaka4 years ago

Replying to scribu:

Couldn't the same effect be achieved by using add_post_type_support() and remove_post_type_support() ?

There's no filter on current_theme_supports() either.

The use case I'm thinking of is for enforcing a certain combination of support features, or disallowing certain combinations. In particular, for this plugin, I want to ensure that post types that support 'xmldoc' do not support 'editor'. I don't think there's a good way to do that right now... filtering on add_post_type_support would be an alternative, though, but I think this has more flexibility.

@mitchoyoshitaka4 years ago

Patch v2, passing all args using array_slice

comment:4 @willshouse3 years ago

i also think this would be quite useful. i'm using the verve meta boxes plugin and the gd custom posttypes plugin and want to have a post type which does not "support custom fields" - that is that it would not display that meta box, but i would like to be able to add a custom meta box on the side using the verve plugin. rather than rewriting the verve meta plugin i think it would be easier to get the desired behavior using this filter. so +1

comment:5 @sorich873 years ago

  • Type changed from defect (bug) to enhancement

comment:6 @flyingtrolleycars2 years ago

  • Cc andrew@… added
Note: See TracTickets for help on using tickets.