This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
post_type_archive_title filter
Filters the post type archive title.
apply_filters( 'post_type_archive_title', string $post_type_name, string $post_type )
Description
This is filter hook , its filter the post type archive title.
Its consists of two parameters, one is $post_type_name, second is $post_type .
It is used in post_type_archive_title() which display or retrieve title for a post type archive.
Parameters
- $post_type_name : (string) Post type ‘name’ label.
- $post_type : (string) Post type.
Live Example
To run the hook, copy the example below.
$object_labels_name = apply_filters( 'post_type_archive_title', $object_labels_name, $object_name ); if ( !empty( $object_labels_name ) ) { // everything has led up to this point... }
The following example is for adding a hook callback.
// define the post_type_archive_title callback function filter_post_type_archive_title( $object_labels_name, $object_name ) { // make filter magic happen here... return $object_labels_name; }; // add the filter add_filter( 'post_type_archive_title', 'filter_post_type_archive_title', 10, 2 );
To remove a hook callback, use the example below.
// remove the filter remove_filter( 'post_type_archive_title', 'filter_post_type_archive_title', 10, 2 );
Explore the latest in WordPress
Trying to stay on top of it all? Get the best tools, resources and inspiration sent to your inbox every Wednesday.