Definition:
function get_post_types( $args = array() {}
Get a list of all registered post type objects.
Parameters
- array|string $args: An array of key => value arguments to match against the post type objects.
- string $output: The type of output to return, either post type ‘names’ or ‘objects’. ‘names’ is the default.
- string $operator: The logical operation to perform. ‘or’ means only one element from the array needs to match; ‘and’ means all elements must match. The default is ‘and’.
Return values
returns:A list of post type names or objects
Source code
function get_post_types( $args = array(), $output = 'names', $operator = 'and' ) { global $wp_post_types; $field = ('names' == $output) ? 'name' : false; return wp_filter_object_list($wp_post_types, $args, $operator, $field); }
1626
No comments yet... Be the first to leave a reply!