Why does my wordpress structure keep failing?
Hi, I’ve been developing a wp site, the only plugins I use are custom post types and post type converter, and the theme is built from scratch, based on a simple theme I used before, with no problems. Everything but the post types creation are coded. Works great.
I built the structure as this: a “published works” post type, with a main category “published works” and 3 child categories: “books”, “magazines” and “bulletins”. Then, I created pages with the same structure, and coded the theme so it shows the lists of all the items in that category and then a single page that shows the selected item in detail.
So, when I go to the “published works” parent page, It shows 6 items of each category, and clicking on one of them takes you to that item in detail. All with thumbnails, etc, very cool. I also included a child pages list on a corner, so you can go directly to the child pages from there, but clicking on “books” there, it gives me a 404 error. I checked the debugging, it said I should include a sidebar page. I included it, but it still 404’s me. Maybe changing the category_names will do, it may be conflicting with the names of the pages,... but nothing. Is there a rule about post types and categories I’m overlooking? (“you shouldn’t do this or this, try this because it conflicts with…” etc?)
Observing members:
0
Composing members:
0
5 Answers
404 is pretty unambiguous, something is wrong with your link URL for “books” (in your example).
Some guesses
1) If you’re using relative links (<a href=”./books”>) then you may not be “starting” where you think you are. Check your current URL and make sure it’s as expected. WordPress does a ton of redirecting depending on how you have your permalinks set up
2) Make sure you have permalinks set up how you’re expecting
3) If you aren’t using “pretty” permalinks in the Settings, all bets are off
4) If you’re having wordpress generate the menu, or iterating through an array you’re pulling, output the whole thing (print_r($links) for example) and make sure you’re using the right attribute and it contain exactly what you’re expecting. Similar items have slightly different versions of URLs, you can check the codex, but usually just dumping the whole thing to the page is quicker and more definitive for development
5) remember you might have a root defined for categories or for the your post type, something like www.yourawesomesite.com/categoryies/thiscategory/
A link to your site would probably tell a lot more, but maybe start with those?
Hi @funkdaddy , I have pretty permalinks from the beggining. And I have the structure with nested pages, and the same goes for the categories; So maybe that should be causing trouble… So the category_name “magazines” changed to “mags” to be different to the page name “magazines”.
Later, I used Post type Converter to correct move around posts and get everything stright according to the structure, but thats it, the site doesn’t seem to get to the second layer of the navigation… I’ll be uploading the site soon, it’s in my local server yet.
I might have a clue about the problem: I deleted a post type I created, “projects” and deleted the child pages of “projects” from the main menu. But I didn’t delete the parent page. So, I created a new page under Projects, and it keeps sending me to the Home page. -update: Now I went to permalinks and saved the settings again (without modifying anything) and now the child page works ok. So i think the problem goes along the line of page/custom post names…
Saving permalinks recreates and resaves your htaccess rules, so if you have any other plugins that modify those, you might want to take a look there…
yeah, I changed to defaults permalinks and the problem disappeared completely. I must change custom posts names. and when its all set, I’ll try pretty permalinks again…
Answer this question
This question is in the General Section. Responses must be helpful and on-topic.