Core Function
View Source on Trac ↗ get_post_types()
get_post_types( mixed $args = array(), mixed $output = 'names', mixed $operator = 'and' ) Gets a list of all registered post type objects.
Parameters 3 required
| Name / Type | Description |
|---|---|
| mixed | (array | string) $args Optional. An array of key => value arguments to match against the post type objects. Default empty array. Required |
| string | $output Optional. The type of output to return. Either 'names' or 'objects'. Default 'names'. Required |
| string | $operator Optional. The logical operation to perform. 'or' means only one element from the array needs to match; 'and' means all elements must match; 'not' means no elements may match. Default 'and'. Required |
Return Value
((string[])
| WP_Post_Type[]) An array of post type names or objects.
Function Information
Since Version
2.9.0
Source File
wp-includes/post.php
Advertisement