Do you have any sort of links available that I could see this occurring at?
Also just to double check, were you fiddling with the slugs/etc for some posts in the post type? or were you fiddling with the post type settings themselves from CPTUI’s menu items?
As a whole, definitely some odd behavior, but at the same time we’re not very involved at all with the post publish process, so it’s hard to say what may be the source of the issue.
Any changes with this one @seanbanksbliss ?
Hi, sorry. For some reason I’m not getting forum update emails. I’ll get back to you on this in the next few days.
Hi,
I am also having a similar challenge. I can see the preview of the post but when I change the status to publish, It brings a 404 error.
Kindly advice on the way forward.
Hi Michael,
I’m having the same issue. To add to the weirdness, I’m finding that it’s only on top level parent pages that are giving the 404. A page that is a 2 or 3 level child page display perfect.
For example,
This page works fine
https://jamescole.com.au/movies/feature-films/stressed-to-kill-trailer/
But this gives a 404
https://jamescole.com.au/movies/feature-films/
and the same for this post type
this works
https://jamescole.com.au/writing/short-stories/flaw-in-the-design/
this doesn’t
https://jamescole.com.au/writing/short-stories/
Any help would be greatly appreciated.
Thanks,
James
Do you have pages named similar to your post types?
Curious what the query args are for your pages that aren’t working, and if it’s perhaps thinking you want a page, when really you’re wanting the post type archives.
I thought of that possibility too so I created a couple of test pages that were unrelated to anything and the same happens.
Works
https://jamescole.com.au/movies/anewpage77/anewpage78/
Don’t work
https://jamescole.com.au/movies/anewpage77/
It’s definitely odd
Forgive my ignorance but what are “query args” and where would I find them to let you know what they are?
These are the custom post type settings I have.
name: movies
label: Movies
singular_label: Movie
description: “”
public: true
publicly_queryable: true
show_ui: true
show_in_nav_menus: true
show_in_rest: false
rest_base: “”
has_archive: true
has_archive_string: movies
exclude_from_search: false
capability_type: page
hierarchical: true
rewrite: true
rewrite_slug: “”
rewrite_withfront: false
query_var: true
query_var_slug: “”
menu_position: “”
show_in_menu: true
show_in_menu_string: “”
menu_icon: “”
custom_supports: “”
title
editor
thumbnail
excerpt
trackbacks
custom-fields
comments
revisions
author
page-attributes
post-formats
movie_categories
movie_tags
query args would be what WP uses to determine what to fetch and display. For example mysite.com/movies/ for an archive. “movies” in the URL would say “query for the latest 10 movie post type posts”. Adding in “/paged/2” would say “give me the next 10” “/movies/the-shining/” would be basically “give me the post named “the-shining” of the “movies” post type. Etc etc.
My go-to plugin for seeing what WP is trying to query for is Query Monitor. http://wordpress.org/plugins/query-monitor/ It’ll be part of the “Request” section once installed and activated.
Thanks for explaining it Michael.
I ran the plugin and got the following results on the two pages mentioned in my previous comment.
https://jamescole.com.au/wp-content/uploads/2018/06/screen1.png
https://jamescole.com.au/wp-content/uploads/2018/06/screen2.png
I hope it makes sense to you.
Looks like screen1.png is showing a potential issue in that it’s thinking it’s found a term archive. Notice how it’s looking for a taxonomy of “movie_tags” and a term of “anewpage77”
Do either of your movie taxonomies have a rewrite slug of “movies” ? That’d definitely contribute to this issue as well.
Nailed it!
Thank you so much Michael.
The rewrite slugs for both tags and categories was set to “movies”
Much appreciated 🙂
James
Welcome. Glad we were able to figure that one out for you.