WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 12 months ago

Last modified 12 months ago

#17584 closed enhancement (wontfix)

Add post_type_supports filter

Reported by: mitchoyoshitaka Owned by: chriscct7
Milestone: Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: has-patch needs-refresh
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 5 years ago.
Patch v2, passing all args using array_slice

Download all attachments as: .zip

Change History (11)

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

#2 follow-up: @scribu
5 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.

#3 in reply to: ↑ 2 @mitchoyoshitaka
5 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.

@mitchoyoshitaka
5 years ago

Patch v2, passing all args using array_slice

#4 @willshouse
5 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

#5 @sorich87
5 years ago

  • Type changed from defect (bug) to enhancement

#6 @flyingtrolleycars
3 years ago

  • Cc andrew@… added

#7 @chriscct7
12 months ago

  • Keywords needs-refresh added
  • Milestone changed from Awaiting Review to 4.4
  • Owner changed from mitchoyoshitaka to chriscct7
  • Severity changed from trivial to normal
  • Status changed from new to assigned

#8 @wonderboymusic
12 months ago

  • Milestone 4.4 deleted
  • Resolution set to wontfix
  • Status changed from assigned to closed

This is basically obsolete since [23722] - use add_post_type_support()

#9 @chriscct7
12 months ago

@wonderboymusic how would that work for the scenario presented in comment:3?

#10 @wonderboymusic
12 months ago

When all of the post types are registered, you can remove the support for editor from the types that support xmldoc using those funcs - turning off support on the fly isn't a feature I see a lot of people screaming for. I remember when Mitcho was talking about this stuff in SF in 2011 at WordCamp. If he wants to reopen the ticket, he can.

Note: See TracTickets for help on using tickets.