Skip to content

Instantly share code, notes, and snippets.

@wpscholar
Last active September 4, 2016 08:52
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save wpscholar/6273186 to your computer and use it in GitHub Desktop.
A custom WordPress function to fetch a list of registered post types that support a specific feature.
<?php
/**
* Get a list of post types that support a specific feature.
*
* @param $feature
* @return array
*/
function get_post_types_supporting( $feature ) {
global $_wp_post_type_features;
$post_types = array_keys(
wp_filter_object_list( $_wp_post_type_features, array( $feature => true ) )
);
return $post_types;
}
@wpscholar
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment