I have a page where, with shortcode, I queried multiple posts from a CPT – so the page is one kind of archive page to the general users.
Page Title
- CPT Post Title #1
- CPT Post Title #2
- CPT Post Title #3
In certain condition I want to alter only the Page Title, not CPT Post Title. I tried:
function wpse_change_page_title( $title ) {
//if( condition matched ) {
return 'Test ' . $title;
//}
}
add_filter( 'the_title', 'wpse_change_page_title' );
But it’s altering the CPT Post Titles.
Page Title
- Test CPT Post Title #1
- Test CPT Post Title #2
- Test CPT Post Title #3
How can I alter only the Page title, not those CPT Post Titles?
Test Page Title