Why is it necessary?
I need, I think, not only me, one thing is the condition for displaying content inside the page, another thing is the condition for displaying the page as a whole, how search engines see it.
For example, inside the template there are 3 sections with display conditions:
The product is available for viewing, but without the buy button, since it is not yet in stock, everything is clear here. It is indexed, visible, returns 200.
The goods are bought. Landing page returns 503 no matter what is indexed. Inside the template, the condition of another section works.
The product is in custom status. The page gives 404, for those to whom it is not intended, but in fact it is, and the condition of another section works inside the template.
This applies not only to products, but also to other types.
Since I was directed to follow this thread by Itchycode on a page that had marked a 404 issue solved:
I’ll just update it with my scenarios where the custom 404 template doesn’t get used for some reason.
The code snippet below that uses
add_action( 'template_redirect', ...
will not use the Bricks 404 template but just shows the default one with the “Whoops, that page is gone” message.
// For example: https://domain.com/category/uncategorized/
// If not using Category Taxonomy deleting of Uncategorized Category not possible
function ess_disable_uncategorized_category_archives() {
// if we are on Uncategorized category archive page
if (is_category('uncategorized')) {
global $wp_query;
$wp_query->set_404();
status_header(404);
}
}
// Disable access
add_action( 'template_redirect', 'ess_disable_uncategorized_category_archives' );
I also have a code snippet similar to the above that 404’s home pages that the URL may contain unneeded pagination like:
The 404 status code is returned but neither the default 404 page or my custom 404 template is returned. Instead the homepage is returned (with a 404 status code) and anything that is queried is empty.
This issue also has been discussed in most of the other topics about 404 issues.
Thanks that works and the custom 404 error template is used. It also works for a snippet I have for disabling pagination on custom post types and custom taxonomies (since I use a load more button on these and actually do not need separate pages).
It doesn’t catch the home page one though and instead a redirect happens back to the actual homepage.
mydomain.com/page/2/
This is better than redisplaying the homepage with empty queries as what happened before on non-existent pages though so that is okay.
Hey,
For me, the 404 template also works with non-existent WooCommerce categories
In order to provide a solution, I need to check the settings of your 404 error template. Could you please provide temporary admin access to your WordPress dashboard? Send the details to help@bricksbuilder.io, referencing this thread.
Thanks for the login details.
Identified that the FacetWP - Bricks Builder integration plugin causing the issue.
Deactivate the plugin and Bricks 404 template is working well.
Kindly reach out to their support. Thank you.
Hi Maximus,
Would you be so kind as to send temporary login credentials and a link to this thread to help@bricksbuilder.io using the email address you used during the purchase? Then, one of the developers can look at your problem in detail.
it is resolved, just pushed the patch to production. it was not published before. but clicking both links results in expected behavior. at least for us.
The easiest way to reproduce this issue is by ticking the checkbox that tells search engines not to index (wp settings) and then trying to access the /wp-sitemap.xml page. It throws the “Whoops” page instead of the template.