# Redirection 404 not using error page template

**URL:** <https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789>\
**Category:** How To\
**Created:** [March 18, 2023, 9:40am UTC](https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789 "2023-03-18T09:40:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![mackarias](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/mackarias/32/23119_2.png) [@mackarias](https://forum.bricksbuilder.io/u/mackarias)\
**Post date:** [March 18, 2023, 9:40am UTC](https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789/1 "2023-03-18T09:40:45Z")

</div>

I have set up a 404 error response for the ‘uncategorised’ default wp category archive page using the redirection plugin. This redirects to a (presumably) wordpress default 404 page and not the error page template that is set up in bricks.

Archive page in question [https://forestretreats.co.uk/category/uncategorised/](https://forestretreats.co.uk/category/uncategorised/)

Bricks error page [https://forestretreats.co.uk/category/uncategorised/blahblah](https://forestretreats.co.uk/category/uncategorised/blahblah)

Is there a way to fix this? Happy to use a code snippet if theres a better way to handle this other than redirection plugin.

Thanks 🙂

---

<div class="post-metadata">

**Author:** ![Tom](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/t/3d9bf3/32.png) [@Tom](https://forum.bricksbuilder.io/u/Tom)\
**Post date:** [June 1, 2023, 1:21pm UTC](https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789/2 "2023-06-01T13:21:05Z")

</div>

Did you figure out a solution to this? (from the URLs it looks like not)

I posted a similar question recently:

> [@How Do I Set a 404 Error in PHP and have the Bricks 404 Error Page show?](https://forum.bricksbuilder.io/t/how-do-i-set-a-404-error-in-php-and-have-the-bricks-404-error-page-show/12651):
>
> In a few code snippets I may have to trigger a 404 error which I do with the following code. // error 404 is displayed global $wp\_query; $wp\_query-\>set\_404(); status\_header(404); The thing I notice is that WordPress just shows the standard " Whoops, that page is gone" 404 page instead of the Bricks Error Page template I have all setup. The Bricks Error template page works fine for missing pages when typed in the browser URL but not when a 404 er…

and found another similar one:

> [@WIP: Can't see the 404 template](https://forum.bricksbuilder.io/t/cant-see-the-404-template/9609):
>
> I had a post about how to make certain page output conditions? I never got a response, but I did it anyway. add\_action( 'template\_redirect', 'my\_404event', 1 ); function my\_404event() { global $post, $wp\_query; if ( is\_singular( 'product' ) && get\_post\_status( $post )=='approved' && $post-\>post\_author != get\_current\_user\_id()) { $wp\_query-\>set\_404(); status\_header(404); include( get\_query\_template( '404' ) ); // include( get\_404\_template()); exit…

but no answers… there has to be a way to load the Bricks custom 404 error page…

---

<div class="post-metadata">

**Author:** ![mackarias](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/mackarias/32/23119_2.png) [@mackarias](https://forum.bricksbuilder.io/u/mackarias)\
**Post date:** [June 2, 2023, 7:37am UTC](https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789/3 "2023-06-02T07:37:32Z")

</div>

No this did not get fixed in the end

---

<div class="post-metadata">

**Author:** ![Tom](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/t/3d9bf3/32.png) [@Tom](https://forum.bricksbuilder.io/u/Tom)\
**Post date:** [June 2, 2023, 10:59am UTC](https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789/4 "2023-06-02T10:59:20Z")

</div>

I got a response in my post. I hope they look into this more. I did look into the code a bit and the Bricks 404.php file does get called but for some reason it doesn’t find the custom error template for some reason and it defaults to the simple default one they created (with the Whoops message)

---

<div class="post-metadata">

**Author:** ![floridaseating](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/f/a587f6/32.png) [@floridaseating](https://forum.bricksbuilder.io/u/floridaseating)\
**Post date:** [July 20, 2023, 12:19am UTC](https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789/5 "2023-07-20T00:19:05Z")

</div>

any official solution come about yet?

---

<div class="post-metadata">

**Author:** ![Tom](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/t/3d9bf3/32.png) [@Tom](https://forum.bricksbuilder.io/u/Tom)\
**Post date:** [July 20, 2023, 9:54am UTC](https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789/6 "2023-07-20T09:54:55Z")

</div>

No not yet. In my other post on the topic I showed Bricks where in their code it was failing to detect the 404 template but no response from them if a fix is in the works.

---

<div class="post-metadata">

**Author:** ![MartinWB](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/martinwb/32/22977_2.png) [@MartinWB](https://forum.bricksbuilder.io/u/MartinWB)\
**Post date:** [July 20, 2023, 10:27am UTC](https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789/7 "2023-07-20T10:27:15Z")

</div>

Hi all,

maybe try this for now.

```auto
function redirect_uncategorized_posts() {
    if (is_single() && in_category('uncategorized')) {
        wp_redirect(home_url('/404')); // Redirect to the 404
        exit();
    }
}
add_action('template_redirect', 'redirect_uncategorized_posts');

```

---

<div class="post-metadata">

**Author:** ![Tom](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/t/3d9bf3/32.png) [@Tom](https://forum.bricksbuilder.io/u/Tom)\
**Post date:** [July 20, 2023, 11:01am UTC](https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789/8 "2023-07-20T11:01:07Z")

</div>

Your solution will not work as the problem actually starts in the Bricks 404 page file. It looks for a template file and doesn’t find one and displays just a default whoops message.

There is a bug in certain situations as the template array Bricks checks for an error file has not been updated yet.

---

<div class="post-metadata">

**Author:** ![floridaseating](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/f/a587f6/32.png) [@floridaseating](https://forum.bricksbuilder.io/u/floridaseating)\
**Post date:** [July 22, 2023, 12:08am UTC](https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789/9 "2023-07-22T00:08:07Z")

</div>

anyone have a fix?‎‎‎‎‎‎‎

---

<div class="post-metadata">

**Author:** ![stevengrass](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/s/f07891/32.png) [@stevengrass](https://forum.bricksbuilder.io/u/stevengrass)\
**Post date:** [July 22, 2023, 6:27am UTC](https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789/10 "2023-07-22T06:27:23Z")

</div>

I also tried but didn’t get fix.

---

<div class="post-metadata">

**Author:** ![floridaseating](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/f/a587f6/32.png) [@floridaseating](https://forum.bricksbuilder.io/u/floridaseating)\
**Post date:** [September 7, 2023, 3:23am UTC](https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789/11 "2023-09-07T03:23:05Z")

</div>

any update on this?? @timmse

---

<div class="post-metadata">

**Author:** ![Scott](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/scott/32/2281_2.png) [@Scott](https://forum.bricksbuilder.io/u/Scott)\
**Post date:** [September 23, 2023, 12:12am UTC](https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789/12 "2023-09-23T00:12:16Z")

</div>

Can confirm after creating and designing an Error 404 template and assigning it Template Settings \> Conditions \> (show on) Error page, Bricks only shows the default template containing: “Whoops, that page is gone” and a search box. Switching off Bricks \> Settings \> Templates\> Disable default templates has no change in effect.

- Bricks v1.9.1.1
- Breeze (2.0.29)
- Object Cache Pro is disabled

---

<div class="post-metadata">

**Author:** ![jpgb](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/jpgb/32/14063_2.png) [@jpgb](https://forum.bricksbuilder.io/u/jpgb)\
**Post date:** [September 26, 2023, 4:05pm UTC](https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789/13 "2023-09-26T16:05:51Z")

</div>

This does appear to be a bug. I have it working on one site and not another using the same conditions. So I am assuming an update has knocked something out of whack here. The 404 page should display when the condition of the template is set to error page (show). But it isn’t.

---

<div class="post-metadata">

**Author:** ![stuismad](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/stuismad/32/6642_2.png) [@stuismad](https://forum.bricksbuilder.io/u/stuismad)\
**Post date:** [September 28, 2023, 4:18am UTC](https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789/14 "2023-09-28T04:18:53Z")

</div>

Same thing here. Oddly enough 404 was working just fine until recent update for me, but now just shows the “Whoops” page with search bar. I’ve submitted a bug report.

---

<div class="post-metadata">

**Author:** ![timmse](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/timmse/32/1192_2.png) [@timmse](https://forum.bricksbuilder.io/u/timmse)\
**Post date:** [October 20, 2023, 8:14am UTC](https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789/15 "2023-10-20T08:14:38Z")

</div>

Hi guys,  
This issue should have been fixed with Bricks 1.9.2 - please have a look at the corresponding bug report: [SOLVED: 404 Page Template not Showing despite conditions set](https://forum.bricksbuilder.io/t/solved-404-page-template-not-showing-despite-conditions-set/15812)

---

<div class="post-metadata">

**Author:** ![floridaseating](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/f/a587f6/32.png) [@floridaseating](https://forum.bricksbuilder.io/u/floridaseating)\
**Post date:** [October 20, 2023, 8:27am UTC](https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789/16 "2023-10-20T08:27:22Z")

</div>

can confirm. thanks for the update @timmse

---

<div class="post-metadata">

**Author:** ![stuismad](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/stuismad/32/6642_2.png) [@stuismad](https://forum.bricksbuilder.io/u/stuismad)\
**Post date:** [October 22, 2023, 9:03pm UTC](https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789/17 "2023-10-22T21:03:01Z")

</div>

thank you so much for your help as always @timmse

---

<div class="post-metadata">

**Author:** ![Tom](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/t/3d9bf3/32.png) [@Tom](https://forum.bricksbuilder.io/u/Tom)\
**Post date:** [November 23, 2023, 1:43pm UTC](https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789/18 "2023-11-23T13:43:22Z")

</div>

This issue has not been fixed as far as I can tell as I have the same problem as before.

For a more complete explanation see:

> [@SOLVED: 404 Page Template not Showing despite conditions set](https://forum.bricksbuilder.io/t/solved-404-page-template-not-showing-despite-conditions-set/15812/12):
>
> 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. [https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789/6](https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789/6)[https://forum.bricksbuilder.io/t/how-do-i-set-a-404-error-in-ph…](https://forum.bricksbuilder.io/t/how-do-i-set-a-404-error-in-php-and-have-the-bricks-404-error-page-show/12651/9)

---

<div class="post-metadata">

**Author:** ![floridaseating](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/f/a587f6/32.png) [@floridaseating](https://forum.bricksbuilder.io/u/floridaseating)\
**Post date:** [February 22, 2024, 11:37pm UTC](https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789/19 "2024-02-22T23:37:08Z")

</div>

experiencing this issue - current version of bricks as of writing:

example: [https://floridaseating.com/product-category/quick-ship/outdoor-quick-ship/404asdf](https://floridaseating.com/product-category/quick-ship/outdoor-quick-ship/404asdf)

yet it works here: [https://floridaseating.com/sdcsdc](https://floridaseating.com/sdcsdc)

---

<div class="post-metadata">

**Author:** ![fabr](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/f/bc79bd/32.png) [@fabr](https://forum.bricksbuilder.io/u/fabr)\
**Post date:** [June 6, 2024, 9:02pm UTC](https://forum.bricksbuilder.io/t/redirection-404-not-using-error-page-template/10789/20 "2024-06-06T21:02:54Z")

</div>

Any updates on this?

I’m facing the issue, one year later. Doesn’t seem to be fixed @timmse. **This is a massive bug that means we can’t send people to 404 using PHP** , which is quite a usual thing.

Works on every other theme I tested it with.

I used a more complex code snippet in the video, but it’s the same if I try to send a normal permalink to 404. I also didn’t use a child theme, as this is for demonstration only. It’s from wetransfer, so it won’t be up for long: [WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free](https://we.tl/t-WnaMdF4wGr).

You get the same error page if you set your site not to index (in the WordPress settings) and open /wp-sitemap.xml.

That’s a copy of my answer over here:

> [@How Do I Set a 404 Error in PHP and have the Bricks 404 Error Page show?](https://forum.bricksbuilder.io/t/how-do-i-set-a-404-error-in-php-and-have-the-bricks-404-error-page-show/12651/11):
>
> Same issue here, one year later. This is a massive bug that means we can’t send people to 404 using PHP, which is quite a usual thing. Any updates? Works on every other theme I tested it with. I used a more complex code snippet in the video, but it’s the same if I try to send a normal permalink to 404. I also didn’t use a child theme, as this is for demonstration only. It’s from wetransfer, so it won’t be online for long: [https://we.tl/t-WnaMdF4wGr](https://we.tl/t-WnaMdF4wGr). Can we flag this thread as “bug”?
