ShoutMeLoud – Shouters Who Inspire

Superlinks
≡ Menu

How to Redirect 404 Pages in Thesis to Custom 404 Error Page

How to Redirect 404 Pages in Thesis to Custom 404 Error Page

We all know how good Thesis Theme is and how much it helps to lower down WordPress plugins. Some time back we shared how to customize Thesis 404 pages and here I’m sharing another tip to redirect your 404 pages to any custom page of your choice.

This is useful to make sure, when people are landing on 404 pages, instead of getting a blank screen or annoying we couldn’t find anything error, we can redirect them to a custom page showing most popular post or may be a post with some interesting 404 images.

404errorpage thumb

This is something which one of my client wanted (via Thesis customization service) and we altered the Thesis 404 hooks to make sure that his 404 error pages should redirect to a custom page.

Here is the code which you need to add into your custom_functions.php file:

   1: //404 Redirect Hook

   2:

   3: function custom_thesis_404_redirect() {

   4: // Change to the URL you want to redirect to

   5: $URL="http://thesiscustomizationservice.com/";

   6: header ("Location: $URL");

   7: }

   8: remove_action('thesis_hook_404_content', 'thesis_404_content');

   9: add_action('thesis_hook_404_content', 'custom_thesis_404_redirect');

That’s it. Once you are done adding the code it will start redirecting all visitors (404 Error page visitors) to the link you specified in the above code. This will also help you to lower down blog bounce rate.

I’m sure those who are using Thesis theme will like this tip and if you are still not using Thesis theme, you can grab one now.

Get Thesis WordPress theme.

  • Author Bio

  • Latest Post

Article by Harsh Agrawal

Harsh has written 1062 articles.

If you like This post, you can follow ShoutMeLoud on Twitter. Subscribe to ShoutMeLoud feed via RSS or EMAIL to receive instant updates.


{ 11 comments… add one }

  • Prasanthreddy Arikatla

    How about thesis 2.1 – the 404 edit page button leads to the list of pages, I can’t find a way to edit it.

    Reply
  • sorodocul

    It doesn’t work, try updating this post with the following code:

    function simple_redirect() {
    if(is_404()) {
    wp_redirect( ‘http://www.yoursite.com’, 301 );
    }
    }
    add_action(‘template_redirect’, ‘simple_redirect’);

    Reply
  • Alex the best

    I add this code in custom function file but it doesn’t work? Still showing default 404 page
    What i am missing?

    Reply
  • Chung

    specific code for Thesis OpenHook.

    I’m trying not to play around with custom_function and woul dlike to get good at using thesis openhook plugin to put in code.

    any ideas?

    Reply
  • Chung's site

    Hey Harsh,

    I’m having an issue when trying to put the code into Thesis OpenHook => 404 content – can you tell me the exact code that I should be using?

    Thanks a bunch.

    Chung

    Reply
    • Harsh Agrawal

      Chung have you tried adding this codes into your custom_function file or you need code specifically for Thesis open hook plugin?

      Reply
  • Saksham

    Loved this short piece of tutorial and the code. Thanks Harsh for this!

    Reply
  • Vijayraj Reddy

    Ya, using this custom 404 page lowers bounce rate, thx for the tutorial…

    Reply
  • Manikandan J

    Yes i strongly agree with you Harsh!When visitors came through search Engine unfortunately if the expected post is Unavailable,the visitor may back to the Search Result.Yes,it happens due to Human cytology.If we customize the 404 pages,the user mayn’t leave the site,so it definitely decrease the site’s bounce rate!

    Reply
  • Sharat

    I am using thesis for two of my blogs. Will give a try .. :) Thanks for sharing

    Reply
  • kbharath @ Techntricksonline

    Thanks for sharing this awesome info Harsh i will try this.

    Reply

Leave a Comment