i'd like to show the CPT description on the archive.php page but it'd like to do it dynamically for all CPT's. I mean without specifying the current type myself. Something like the_archive_description but for CPT.


Since 4.9.

if ( get_the_post_type_description()) {

echo get_the_post_type_description();


redeclaring the function will crash WordPress.

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 = '';
    return apply_filters( 'get_the_post_type_description', $description, $post_type_obj );

Here is a future function of WP v4.9 that retrieves the description for a post type archive and returns (string) The post type description. I think it can do the trick for you.

  • NVM i had to echo the function, all good, works! – Michael Rogers Oct 4 '17 at 10:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.