Reputation: 291
I have a cutom post type products with a post say 'abc'.
The permalink for this post shows up as homedir/products/abc.
However following the link generates a 404 page even though I have both archive-products and single-products page.
Is there any way to see what file/template wordpress wants to display the link. Also why doesnt the wordpress engine fallbacks to the index page template or any other template for that matter.
Upvotes: 0
Views: 248
Reputation: 2471
Here is WordPress' Template Hierarchy. Check this
And to see what template is being used, you can try this:
add_action('wp_head', 'show_template');
function show_template() {
global $template;
print_r($template);
}
WP has a global $template
More info here
Also, since you're getting a 404 error. You should see whether the post actually resolves to the URL you're using.
Upvotes: 1
Reputation: 197624
It does not fall-back because your link is creating a 404 (not found). That basically means that the page to load is the 404 page and therefore the 404 template is taken. So everything is correct with the templates.
What you miss is that the URL does not resolve to your custom post thingy, so probably you might need to refresh permalinks and/or check your custom post type configuration / mapping / querying.
Upvotes: 0