WordPress at a glance

get_the_post_type_description() WP 1.0

Retrieves the description for a post type archive.

Works based on: get_post_type_object()
✈ 1 time = 0.000249s = fast | 50000 times = 0.30s = very fast PHP 7.1.5, WP 4.9

No Hooks.

Return

String. The post type description.

Usage

get_the_post_type_description();

Code of get_the_post_type_description: wp-includes/general-template.php VER 5.0.1

<?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 );
}

Related Functions

From tag: Archive pages

More from category: Custom Types

No comments
    Hello, !     Log In . Register