SOLVED: 404 Page Template not Showing despite conditions set

Hi Timmse,

This is not a complete fix (at least it is not working in Bricks 1.9.3). 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.

This issue has been discussed in most of the other topics about 404 issues.

// 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' );
1 Like