How to get link to custom post type archive page? [wordpress]
10,643
Solution 1
I belive you are looking for this get_post_type_archive_link('post_type');
. More info here: http://codex.wordpress.org/Function_Reference/get_post_type_archive_link
Solution 2
In case get_post_type_archive_link()
returns false
, make sure that you have used the argument has_archive => true
when using register_post_type()
.
Author by
Bojana Šekeljić
Updated on June 05, 2022Comments
-
Bojana Šekeljić almost 2 years
I have custom posts loop and at the bottom I want to add "View all" link that should lead to the page with all posts of that type.
The only solution I could think of is to have a template page for the post type and hardcode the link to it, but I am hoping for a more elegant and dynamic solution.
I've checked out the Codex and none of the functions seems to cover this.
Thanks
Bojana