Definition:
function wp_get_post_categories( $post_id = 0, $args = array() {}
Retrieve the list of categories for a post.
Compatibility layer for themes and plugins. Also an easy layer of abstraction away from the complexity of the taxonomy layer.
Parameters
- int $post_id: Optional. The Post ID.
- array $args: Optional. Overwrite the defaults.
Source code
function wp_get_post_categories( $post_id = 0, $args = array() ) { $post_id = (int) $post_id; $defaults = array('fields' => 'ids'); $args = wp_parse_args( $args, $defaults ); $cats = wp_get_object_terms($post_id, 'category', $args); return $cats; }
3729
No comments yet... Be the first to leave a reply!