Compatibility layer for themes and plugins. Also an easy layer of abstraction away from the complexity of the taxonomy layer.
Parameters
$post_idintoptional
The Post ID. Does not default to the ID of the global $post. Default 0.Default: 0
$argsarrayoptional
Category query parameters. Default empty array. See WP_Term_Query::__construct() for supported arguments.Default: array()
Return
array|WP_Error
List of categories. If the $fields argument passed via $args is 'all' or 'all_with_object_id', an array of WP_Term objects will be returned. If $fields is 'ids', an array of category IDs. If $fields is 'names', an array of category names. WP_Error object if 'category' taxonomy doesn't exist.
Uses · 2
wp_parse_args()Merges user defined arguments into defaults array.
wp_get_object_terms()Retrieves the terms associated with the given object(s), in the supplied taxonomies.
Used by · 9
bulk_edit_posts()Processes the post data for the bulk editing of posts.
Signature, return type and hooks compared across 5 parsed releases.
About this page
Parsed data
Generated from the wordpress-develop 6.7.7 tag, from src/wp-includes/post.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.