Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #874096
    helloeng
    Participant

    Hi

    My X custom 404 is not working anymore. See attached pictures. 1) plugin is active 2) custom 404 enabled 3) the custom 404 I created 5) What I see (just a blank 404 page)

    Thanks

    #874102
    helloeng
    Participant
    This reply has been marked as private.
    #874726
    Rue Nel
    Moderator

    Hello There,

    Thanks for providing a very detailed information. I can confirm that this is a bug in the custom 404 extensions. I managed to have a temporary fix for your web site. I added this function in your child theme’s functions.php file

    // Fix custom 404 bug
    // =============================================================================
    function just_another_404_filter($template){
      require( X_CUSTOM_404_PATH . '/functions/options.php' );
    
      if ( ! isset( $x_custom_404_enable ) || ! $x_custom_404_enable ) {
        return $template;
      }
    
      $custom_404_post = get_post( (int) $x_custom_404_entry_include );
    
      if ( ! is_a( $custom_404_post, 'WP_Post' ) ) {
        return $template;
      }
    
      GLOBAL $wp_query;
      GLOBAL $post;
    
      $post = $custom_404_post;
    
      $wp_query->posts             = array( $post );
      $wp_query->queried_object_id = $post->ID;
      $wp_query->queried_object    = $post;
      $wp_query->post_count        = 1;
      $wp_query->found_posts       = 1;
      $wp_query->max_num_pages     = 0;
    
      $wp_query->is_404            = false;
      $wp_query->is_page           = true;
      $wp_query->is_singular       = true;
    
      return get_page_template();
    }
    add_filter( '404_template', 'just_another_404_filter', 100 );
    // =============================================================================

    You should be able to see the custom 404 page now. No need to worry when there is an extension update as this code doesn’t have any conflict.

    If you need anything else, please let us know.

    #875055
    helloeng
    Participant

    Hi

    Yes, it works now.

    Thank you 😉

    #875411
    Rupok
    Member

    You are welcome!

    Glad that it helped. Feel free to let us know if you face any other issue. We’ll be happy to assist you.

    Thanks for using X.

    Cheers!

    #876262
    helloeng
    Participant

    I will. Thanks 😉

    #876603
    Paul R
    Moderator

    You’re welcome! 🙂

    #989933
    LMMorales
    Participant

    I think am having this same issue at http://www.1stChoiceRoofs.com. The Custom 404 isn’t directing to the page “Houston Roofing & Construction” like it’s supposed to. Instead, it’s showing what looks like website search results. Can you help me? I don’t have a child theme installed.

    #990385
    Rahul
    Moderator

    Hey there, Please create a child theme and send us your admin credentials and we’re happy to help!

  • <script> jQuery(function($){ $("#no-reply-874096 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>