Skip Navigation

[Resolved] How to show 404 page when a post is missing layout template

This support ticket is created 5 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

Our next available supporter will start replying to tickets in about 6.23 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 12 replies, has 2 voices.

Last updated by Beda 5 years, 3 months ago.

Assigned support staff: Beda.


I am using GeneratePress theme with Toolset, now I set up a child post type with repeating field group, but no display that, because I just want to display parent posts, on that theme, if I don't assign a layout template, the custom post type is still displayed as long as the feature image and visual editor of the post type are enable. an odd thing, the child post type generated is by front-end submission form, so if I don't assign a layout template, the form with the problem will be displayed on each post.
1. is that normal if display a form with the problem;
2. how can I make the post display 404 page if the post type is without layout template.

I have tested using your reference site. it is same. but it doesn't show up a creepy form.

Thank you so much!


Show you a screenshot.
Other issues, I found if the post status is pending or draft, the form will not be shown, but the page is still existing.
2. if I set up the content title is disable, it is only taking effect when the post type is published. draft or pending is not affected.

Thank you!


When you see ShortCodes like that on the Front End it means the Plugin that registers those ShortCodes is not active.

That would mean, CRED is not active, but I see it in your Debug Log.

Hence this is a mystery.
It cannot happen unless your Theme or other code disables ShortCodes completely, or you have CRED disabled.

Please share with me:
- access to the site as an admin
- link to the CRED form in the backend where you edit the form
- link to where you insert the form
- link to where I can see the form on the front end.

I will then see what is causing this, if I cannot spot it I will need to ask for a copy of the site as well:


Hi Beda, Thank you so much for the reply, this issue may cause by something I assigned an old template layout. I have deleted that post, and the issue disappeared.

but the second issue is still existing. my goal is when a post has not a template layout, the post should be redirected to 404 page when visitor hits. but genereatepress uses default single.php, that means if no template is assigned to, the post will use default single.php, this is why the page will be shown, and not a 404 page I guess. I have uploaded some screenshots, please check it out, and you can also use GeneratePress as the current theme, you will see this issue.


my goal is when a post has not a template layout, the post should be redirected to 404 page when visitor hits.

There is no way to do this unless you apply the custom code.
If you apply custom code, you will need to know that the Toolset Layouts assigned to posts can be retrieved by checking the hidden custom field "_layouts_template".
This Custom Field, stored for each post, will hold the Slug of the assigned Toolset Template Layout
Hence if it's empty, or does not exist, no layout is attached, and then you can call a specific another template - but you need to do that in PHP.

If you want to display a 404 when the user is not allowed to see the content, then this is a different thing and can be set in Toolset > Access > Set error message (for each control).

Also what you can do is set a "default" output in case there is no Layout assigned, but you cannot choose the 404 archive.
You can only choose from a set of already created Toolset Template Layouts.
This is done in Toolset > Settings > Layouts > What to display if no layout is assigned to content:
- A blank page with a message (customizable message)
- What the theme would output (this is the default)
- The content using a following 'default' Layout (here you could mimic the 404 page with a Layout and use this)

To have these changes visible for everyone you should choose "Set this option for: All users".

Note that this will not work on Toolset Starter Theme, as that one will merely freeze those settings, and not allow you to edit them.

I think with this information you should be able to achieve your goal.
Please let me know if something's unclear.


It does make sense, Thank you so much! 🙂


Hi Beda

Learnt an HTML tag from you. ?, now I am using GeneratePress
Thank you so much for the reply, I have set a layout according to your explanation, a page not found layout to the default layout, it seems not working properly because if I set a layout as default layout, the theme's 404 template file will not work, that means if an url with typo, the 404 page will not be shown. Also, I can set A blank page with a message (customizable message), I found It can replace theme's 404 page completely and can insert HTML tags , I didn't test if it can insert a view or not. but there is a title cannot be hidden, do I have a way to customize theme's 404 page using layout? or just set theme's 404 page to default page. or fully control the "A blank page with a message (customizable message), " ?



You can use these HTML tags in this forum (at least, these I tested):


Each one needs of course opening and closing tag 🙂

Related to your last question, you can assign any default layout (In your case, one that is designed like a 404 page) and then assign a layout to the real 404 page directly, which is as well designed like the 404 page (mimics it).
So your default layout does not replace the 404 page but just things where you did not set a template layout, and the 404 still shows with a proper template.

This is after all that you tried to achieve:
How can I make the post display 404 page if the post type is without layout template?


Hi Beda, I Know what you say, and I have tested after you told me that I can set it up at ToolSet figuration page. but the most important thing is GeneratePress is not integrated with ToolSet plugins because there is not a guide for integrating a theme in your site currently, and I worry about if I can get the convenience of the theme if integrate the theme with Toolset. that means I can not control the 404 page, I can assign a layout to the default setting, but it can not replace GeneratePress's 404 page, this is why if I set a layout to default, the theme's 404 page will not work. Thank you!


I also want to try if the post doesn't have a layout, just redirect to home page, or attribution. because I have completely tested with setting a default layout, if some but not all pages with text or plenty of content but without layout will cause showing that layout, it is very odd. So I think redirection that might be a good idea.


I don't understand.
GeneratePress is integrated with Toolset:

If you speak about the integration of Toolset Layouts where you are able to edit the entire Theme (header, footer, sidebar etc), this is not suggested with a Theme like GeneratePress because it's simply overkilled.
If you want to build the theme with Layouts as a full template builder, you would need to create your own minimal theme or use Toolset Starter.

Right now, in themes like GeneratePress, you would design only the_content() part with our Plugins.
This is the part that usually is called "Post Body", as displayed by the theme.
That part is editable with Toolset, always.

You can very well set a default layout that will be called always if no layout is assigned.

But this works only for the content part if the theme is not programmatically adapted, which it is only if you customize the files of your theme.


Hi Beda,

Thank you so much for the reply, I mentioned integration GeneratePress with Toolset, That I just want to state if the theme wasn't integrated with toolset, I cannot fully control the layout, for my case, if I set

What to display if no layout is assigned to content, The content using a following 'default' Layout. and I set a layout named 404 page

yes, the page without an assigned layout will display that layout, but in other pages or pages with wrong URL, that theme's 404 page will not be shown, in this cases, will display a blank page, that means that theme's 404 page will not work. I just want to know if I have a way to set a layout, make it work both 404 page and page or post type without layout.

Thank you!


The problem here is, that Layouts natively will replace the_content().

This means it replaces solely the post body part.

For Error 404, if your theme ships one, you should be able to customize it in Toolset > Layouts > Assign Layouts usage, and then choose the 404 page.

This should then, together with the default layout for when no layout is used, produce this scenario:
- on 404, the 404 layout is shown
- on pages, posts, etc, where no layout is assigned, your custom layout (default) will show
- on all other contents, the assigned layout will show.

Does that not work with your setup?

If so, please let me have a look