Last active
September 4, 2016 08:52
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/wpsmith/6d6679e05c1ab62752ea