Tuesday 15 August 2017

Disable Archive feature of custom post type: WordPress

In one of project we had an requirement where we have to manage the URL as desired by the client like
www.example.com/team/my-team-memeber. (Comes from custom post type post).
www.example.com/team (page not archive page).

We have already registered custom post type with "team" slug and all team members were moved to that custom post type.

And now client wanted to have page for team with this URL www.example.com/team/, for this page he already had added the content using page builder, but somehow the page he was looking is the archive page for Team, whenever he try to look it on front end.

To fix this issue we followed the instructions given in reference website where you have to set false value for the archive for registering the custom post type.

You can look into the code you have used for registering the custom post type and if you find something like this in your code

'has_archive'        => true,


And set it to false like mentioned below.

'has_archive'        => false,

And now you have disabled the archive feature of custom post type.

Reference Websites.
https://wp-types.com/forums/topic/custom-post-type-page-redirecting-to-archive-php-instead-of-page-php/
https://wordpress.stackexchange.com/questions/117368/how-to-remove-custom-post-type-archive



Load disqus comments

0 comments