自定义404和搜索结果未显示

时间:2018-11-15 03:20:54

标签: wordpress seo

我真的不知道为什么我的404页和搜索页在我的wordpress网站上不起作用。它只显示页眉和页脚,我检查div内容及其空白。同时,我使用了重定向到自定义页面的函数,我将其命名为404。我的问题是,将404重定向到特定页面对SEO有益吗?

我使用此代码重定向:

//404 Page
add_action( 'template_redirect', 'Page_not_found' );
function Page_not_found()
{
    // check if is a 404 error
    if( is_404() )
    {
        // then redirect to custom 404
        wp_redirect( home_url( '/page-not-found-404' ) );
        exit();
    }
}

0 个答案:

没有答案