Skip Navigation

[Closed] Custom Post Type archive page

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 9 replies, has 2 voices.

Last updated by Christopher Amirian 7 months, 3 weeks ago.

Assisted by: Christopher Amirian.

Author
Posts
#2640293

jww

I have a custom post type.
I created an archive template then deleted it. Then I created a regular page with that same deleted archive page slug.
I added a 301 redirect to that new page using SEO Press in the meta box. it works fine for the main CPT. This is for the single item within the CPT.
So for Main CPT > 301 redirect > new page, no problem
For single item of that same CPT > 301 redirect > insists on loading an archive page I haven't created. It doesn't respect the 301 but the slug is definitely the same as the new page with the 301 redirect on it.

Any ideas?

#2640295

jww

And I did delete it via Toolset > Content Templates.
I see no evidence of an archive page having been created by anything, yet, the 301 redirect insists on loading an archive page and not redirecting.

#2640475

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

It seems that you have an issue with the archive custom post type default slug in WordPress.

I you created The CPT with Toolset, would you please go to the edit screen of the custom post and change the slug for the archive there?

Then test and see if the redirection works ok for you?

In general, WordPress reserves the slug that you say at the time of the custom post type creation.

Toolset WordPress archive feature uses the same slug but hijacks the default view from the theme you are using and injects whatever you create there.

If you did not add the custom post type with Toolset, please deactivate Toolset to test if the issue is the default WordPress archive slug I mentioned or not. If the issue continues then Toolset does not have a role there.

Thanks.

#2642243

jww

I have my Toolset created custom post type.
It's slug is custom-type-item
When I go to edit the custom post type to add what I want for the archive, it says:
> You cannot use this slug because it is already used or a reserved word. Please choose a different slug.
I'm not trying to change the slug, only add a CPT archive.
Also, when I did this before, it didn't work. I have tried this but it's still an archive template and not the page I want it to be for an archive. But now I can't update anything on the edit post type screen because it's trying to update the slug, which I haven't made any changes to.

#2642251

jww

Still not doing what I want it to.
I renamed the slug.
I did try with has archive checked to add a custom slug there but that does the opposite of what I want - it just creates an archive page with the slug that my static page is at. So that isn't it.

I want there to not be an archive page at all, but to direct the archive link in the breadcrumbs to a static page of my choosing.

My solution so far is this:
renamed the slug so it would let me save
kept has archive checked (per SEO Press support suggestion - so that the next step works)
Created a 301 redirect from the archive slug to the static page.
So far that seems to work.

#2642253

jww

Ummm however changing the slug for the CPT then broke the CPT links. Should I change it back to the original or rewrite permalinks? Luckily it's not live but of course, changing the slug broke all of posts in that CPT link.

#2642255

jww

I re-wrote the permalinks and can access the posts and post type settings again. But wouldn't that have been a total disaster on a live site?

#2642265

jww

That created a total mess to change the slug name. I was wrong, re-writing permalinks didn't solve it.
I'm using WP RSS Aggregator. It stores the feeds > post type.
All of those are now broken. Re-writing permalinks didn't help.
Now what? It broke 3000 posts.

#2642295

jww

Changing the slug messed up everything WP RSS Aggregator and now the whole site is a giant mess. I'm not sure how to fix it. Now everything is mismatched and not working. Permalinks are all messed up. That was a very bad idea 🙁 It has caused now many hours of a mess I don't know how to fix.

#2642513

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

I am not sure about the WP RSS Aggregator as I am not familiar with that plugin. I suggest that you contact the plugin support to know what to do there.

Now I am confused about the current situation on the archive page. Let's recap what Toolset can offer here:

If you do not want to have the archive page you can always set the has archive option to false.

That will cause the custom post to not show any archive page. You will also need to clear permalinks cache after the change in WordPress > Settings > Permalinks, by re-saving the permalinks there.

Now the point that I mentioned for the slug is still valid, which is upon the custom post type creation time you used a slug to create the post. That slug is a reserved one in WordPress and you can not override that, unless you change the slug of the post to free up the slug for the other one that you want to create.

Just to make sure we are ont he same page, Toolset does not add any additional functionality when it comes to custom post creation and it uses the same methods that WordPress provides for the post creation. So whatever solution you would use with the help of the SEO plugin should have the same result as if you did not use Toolset at all

Thanks.

The topic ‘[Closed] Custom Post Type archive page’ is closed to new replies.