Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there a function that will return the permalink to a custom post types archives that is available to use in WordPress?

Something like:

get_cpt_permalink("events") which will return http://example.com/events/ when has_archive => true on it.

If not what would I need to home brew my own? I'm thinking I would need to read $wp_rewrite and use something along the lines of $wp_rewrite->get_extra_permastruct('events');

share|improve this question

1 Answer 1

up vote 6 down vote accepted

This is what you are looking for get_post_type_archive_link( $post_type );

share|improve this answer
    
Thanks, dunno why I couldn't find this. –  Brady Mar 5 '12 at 10:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.