Title: post_type_archive_title
Published: April 25, 2014
Last modified: May 20, 2026

---

# post_type_archive_title( string $prefix = '', bool $display = true ): string|null

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/post_type_archive_title/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/post_type_archive_title/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/post_type_archive_title/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/post_type_archive_title/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/post_type_archive_title/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/post_type_archive_title/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/post_type_archive_title/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/post_type_archive_title/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/post_type_archive_title/?output_format=md#wp--skip-link--target)

Displays or retrieves title for a post type archive.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/post_type_archive_title/?output_format=md#description)󠁿

This is optimized for archive.php and archive-{$post_type}.php template files for
displaying the title of the post type.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/post_type_archive_title/?output_format=md#parameters)󠁿

 `$prefix`stringoptional

What to display before the title.

Default:`''`

`$display`booloptional

Whether to display or retrieve title.

Default:`true`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/post_type_archive_title/?output_format=md#return)󠁿

 string|null Title when retrieving, null when displaying or on failure.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/post_type_archive_title/?output_format=md#source)󠁿

    ```php
    function post_type_archive_title( $prefix = '', $display = true ) {
    	if ( ! is_post_type_archive() ) {
    		return null;
    	}

    	$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 );

    	/**
    	 * Filters the post type archive title.
    	 *
    	 * @since 3.1.0
    	 *
    	 * @param string $post_type_name Post type 'name' label.
    	 * @param string $post_type      Post type.
    	 */
    	$title = apply_filters( 'post_type_archive_title', $post_type_obj->labels->name, $post_type );

    	if ( $display ) {
    		echo $prefix . $title;
    	} else {
    		return $prefix . $title;
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/general-template.php#L1529)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/general-template.php#L1529-L1556)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/post_type_archive_title/?output_format=md#hooks)󠁿

 [apply_filters( ‘post_type_archive_title’, string $post_type_name, string $post_type )](https://developer.wordpress.org/reference/hooks/post_type_archive_title/)

Filters the post type archive title.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/post_type_archive_title/?output_format=md#related)󠁿

| Uses | Description | 
| [is_post_type_archive()](https://developer.wordpress.org/reference/functions/is_post_type_archive/)`wp-includes/query.php` |

Determines whether the query is for an existing post type archive page.

  | 
| [get_query_var()](https://developer.wordpress.org/reference/functions/get_query_var/)`wp-includes/query.php` |

Retrieves the value of a query variable in the [WP_Query](https://developer.wordpress.org/reference/classes/wp_query/) class.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  | 
| [get_post_type_object()](https://developer.wordpress.org/reference/functions/get_post_type_object/)`wp-includes/post.php` |

Retrieves a post type object by name.

  |

[Show 2 more](https://developer.wordpress.org/reference/functions/post_type_archive_title/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/post_type_archive_title/?output_format=md#)

| Used by | Description | 
| [wp_get_document_title()](https://developer.wordpress.org/reference/functions/wp_get_document_title/)`wp-includes/general-template.php` |

Returns document title for the current page.

  | 
| [get_the_archive_title()](https://developer.wordpress.org/reference/functions/get_the_archive_title/)`wp-includes/general-template.php` |

Retrieves the archive title based on the queried object.

  | 
| [wp_title()](https://developer.wordpress.org/reference/functions/wp_title/)`wp-includes/general-template.php` |

Displays or retrieves page title for all areas of blog.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/post_type_archive_title/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/post_type_archive_title/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/functions/post_type_archive_title/?output_format=md#comment-content-594)
 2.   [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/post_type_archive_title/#comment-594)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fpost_type_archive_title%2F%23comment-594)
    Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fpost_type_archive_title%2F%23comment-594)
 4. Display the Custom Post Type title:
 5.     ```php
        <h1><?php post_type_archive_title(); ?></h1>
        ```
    
 6.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fpost_type_archive_title%2F%3Freplytocom%3D594%23feedback-editor-594)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fpost_type_archive_title%2F)
before being able to contribute a note or feedback.