Make WordPress Core

Opened 9 years ago

Last modified 7 years ago

#34009 new enhancement

Need ability to query what post_type_supports values plugins and themes might use

Reported by: bobbingwide's profile bobbingwide Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.4
Component: Posts, Post Types Keywords: needs-patch
Focuses: Cc:

Description

A number of plugins and themes define their own values to pass to add_post_type_support(). e.g. Jetpack's publicize, and the Genesis theme framework's values prefixed with genesis-.

I have a post type UI where I allow the user to decide which feature a post type supports. The current API does not allow me to find the full set of possible values.
$_wp_post_type_features only lets me find out what's currently registered.

I propose a new API get_all_post_type_supports_features() that invokes a filter post_type_supports to allow plugins and themes to return a complete list of post type supports values, along with user friendly labels.

Currently my routine returns the set I can get from $_wp_post_type_features
and my filter function augments it with additional options.

array (
'publicize' => "Publicize with Jetpack"
'home' => "Display in blog home page"
'genesis-layouts' => "Genesis layouts"
 ...
)

WordPress core would respond to the post_type_supports filter with: title, editor, author, etcetera

Attachments (1)

34009.patch (2.8 KB) - added by bobbingwide 7 years ago.
Adds get_all_post_type_supports_features and post_type_supports filter hooks

Download all attachments as: .zip

Change History (3)

#1 @DrewAPicture
7 years ago

  • Keywords needs-patch added

@bobbingwide Would you care to submit a patch demonstrating your proposal?

@bobbingwide
7 years ago

Adds get_all_post_type_supports_features and post_type_supports filter hooks

#2 @bobbingwide
7 years ago

I've added a patch but no tests.

Note: In my local version, I implement my own response to 'post_type_supports' with priority 11.
I've added 'shortlinks' for Jetpack, 'clone' for oik-clone and some more 'genesis-' prefixed ones.

Note: The original code is implemented in my oik-types plugin.

Note: See TracTickets for help on using tickets.