get_the_post_type_description() WordPress Function
The get_the_post_type_description() function is used to get the description of a post type. This can be useful for displaying information about a post type on a post type archive page.
get_the_post_type_description() #
Retrieves the description for a post type archive.
Return
(string) The post type description.
Source
File: wp-includes/general-template.php
function get_the_post_type_description() { $post_type = get_query_var( 'post_type' ); if ( is_array( $post_type ) ) { $post_type = reset( $post_type ); } $post_type_obj = get_post_type_object( $post_type ); // Check if a description is set. if ( isset( $post_type_obj->description ) ) { $description = $post_type_obj->description; } else { $description = ''; } /** * Filters the description for a post type archive. * * @since 4.9.0 * * @param string $description The post type description. * @param WP_Post_Type $post_type_obj The post type object. */ return apply_filters( 'get_the_post_type_description', $description, $post_type_obj ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.9.0 | Introduced. |