When creating a Custom Post, in my case with the name dogs and slug dogs, at the url www.example.com/dogs Wordpress shows by default the archive page if has_archive is set to true

I don't want to deactivate the archive functionality for this CPT, because I would like to have an archive to show animals no more available at the shelter and manually archived.

How can I take advantage of the clean url www.example.com/dogs for showing the index loop? And showing the archive in another location like www.example.com/archive/dogs?


Seems like I just need to set has_archive to a string instead of true with the desired slug, in my case archive/dogs.

Then, create a page with the dogs slug and set the desired template to it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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