I'm trying to generate a list of the categories of my custom post types ('products', and 'specialties'), and nothing will display. Does anyone know what's wrong with this code??

EDIT: The below code is now displaying a link, but will not take me to my custom post types of 'product'..it leads me to a "That page can't be found" page.

<a href="<?php echo get_post_type_archive_link( 'products ); ?>">Products</a>

1 Answer 1


I see you edited your post, did you get it to work for that first part?

now for your edit, you need to give more context. I am able to get the archive link and content using that function. Most likely, you have another code or customization that is conflicting with this function in your setup.

I would check

  • The post type has the has_archive args is set to true.
  • Flush the rewrite rules to make sure they are clean.
  • Look at the timing of your hook call to make sure it is called after your post type is setup

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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