繁体   English   中英

在我的wordpress博客中,当单击分页链接时,它会重定向到错误的网址

[英]in my wordpress blog when click on pagination link it redirect to wrong url

我已经尝试过https://wordpress.org/support/topic/clicking-on-page-2-redirects-to-the-home-page

这是我的分页网址,正确的是http://studycopter.com/feed/page/2/

但是当我单击链接时,它会重定向到http://studycopter.com/page/2/

我检查.htaccess文件永久链接站点url基本url等所有内容,也停用了所有插件

但没有解决问题

请帮我!

解决的问题

由于更改/wp-includes/canonical.php而导致Feed feedworrd,因此会出现问题

//之前的代码是

// paging and feeds
if ( get_query_var('paged') || is_feed() || get_query_var('cpage') ) {
    while ( preg_match( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", $redirect['path'] ) || preg_match( '#/(comments/?)?(feed/rss|rdf|atom|rss2)(/+)?$#', $redirect['path'] ) || preg_match( "#/{$wp_rewrite->comments_pagination_base}-[0-9]+(/+)?$#", $redirect['path'] ) ) {
        // Strip off paging and feed
        $redirect['path'] = preg_replace("#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $redirect['path']); // strip off any existing paging
        $redirect['path'] = preg_replace('#/(comments/?)?(feed/rss2?|rdf|atom)(/+|$)#', '/', $redirect['path']); // strip off feed endings
        $redirect['path'] = preg_replace("#/{$wp_rewrite->comments_pagination_base}-[0-9]+?(/+)?$#", '/', $redirect['path']); // strip off any existing comment paging
    }

    //more code

}

//删除Feed后

// paging and feeds
if ( get_query_var('paged') || is_feed() || get_query_var('cpage') ) {
    while ( preg_match( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", $redirect['path'] ) || preg_match( '#/(comments/?)?(rss|rdf|atom|rss2)(/+)?$#', $redirect['path'] ) || preg_match( "#/{$wp_rewrite->comments_pagination_base}-[0-9]+(/+)?$#", $redirect['path'] ) ) {
        // Strip off paging and feed
        $redirect['path'] = preg_replace("#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $redirect['path']); // strip off any existing paging
        $redirect['path'] = preg_replace('#/(comments/?)?(rss2?|rdf|atom)(/+|$)#', '/', $redirect['path']); // strip off feed endings
        $redirect['path'] = preg_replace("#/{$wp_rewrite->comments_pagination_base}-[0-9]+?(/+)?$#", '/', $redirect['path']); // strip off any existing comment paging
    }

    //more code

}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM