There exists the get_all_post_type_supports()
to get the supported features for a given post type. It’s a wrapper for the _wp_post_type_features
global variable:
/**
* Get all the post type features
*
* @since 3.4.0
*
* @global array $_wp_post_type_features
*
* @param string $post_type The post type.
* @return array Post type supports list.
*/
function get_all_post_type_supports( $post_type ) {
global $_wp_post_type_features;
if ( isset( $_wp_post_type_features[$post_type] ) )
return $_wp_post_type_features[$post_type];
return array();
}
Example:
Here’s an usage example from the wp shell for the 'post'
post type:
wp> print_r( get_all_post_type_supports( 'post' ) );
Array
(
How to get all `supports` attributes by post type? => 1
[editor] => 1
=> 1
[thumbnail] => 1
[excerpt] => 1
[trackbacks] => 1
[custom-fields] => 1
[comments] => 1
[revisions] => 1
[post-formats] => 1
)
Another useful wrapper is get_post_types_by_support()
.