There seems to be some confusion surrounding custom post type archives in WordPress and their lack of title support, some claim that WordPress doesn’t include a title, but this is simply not true. There is most definitely title support but it just seems to simply get overlooked or never realized that it actually exists. So if you’ve ever struggled with figuring out how to display a main title for a post type archive in WordPress or where it pulls from, we will teach you the simple solution intended by the WordPress codex.
Display or retrieve the title for a custom post type archive
Simply copy the code below and use inside your custom post type archive template.<h1><?php post_type_archive_title(); ?></h1>
Where does WordPress retrieve this title from?
The title is simply retrieved from the post type’s general name that you declared when setting up and registering your custom post type. See the example below:'name' => _x('Your Title', 'post type general name')
If you ever want to change the custom post type archive title then you would need to change the general name or display the title in a different manner.
If you are having problems getting this tutorial to work please reread the tutorial and try again, if you still cannot get it to work please leave us a comment below and we will respond as soon as possible. Please do not email us with problems regarding this tutorial, only comments will be responded to.