如何修复自定义wordpress标签分页

时间:2016-02-20 19:44:22

标签: php wordpress pagination

我遇到了分类分页的问题,并使用该代码修复它,但现在我面临着与标签相同的问题, 问题是标签分页给我错误404 这是代码

<?php
function remove_page_from_query_string($query_string)
{ 
    if ($query_string['name'] == 'page' && isset($query_string['page'])) {
        unset($query_string['name']);
        // 'page' in the query_string looks like '/2', so i'm spliting it out
        list($delim, $page_index) = split('/', $query_string['page']);
        $query_string['paged'] = $page_index;
    }      
    return $query_string;
}
// I will kill you if you remove this. I died two days for this line 
add_filter('request', 'remove_page_from_query_string');

// following are code adapted from Custom Post Type Category Pagination Fix
function fix_category_pagination($qs){
          if( (isset($qs['category_name']) || isset($qs['author_name']) || isset($qs['tag']) ) && isset($qs['paged'])){
        $qs['post_type'] = get_post_types($args = array(
            'public'   => true,
            '_builtin' => false
        ));
        array_push($qs['post_type'],'post');
    }
    return $qs;
}
add_filter('request', 'fix_category_pagination');
?>

1 个答案:

答案 0 :(得分:0)

当您将鼠标悬停在链接/按钮上转到下一页时,它将向您发送的地址是什么?

您不必发布您的域名,只需告诉我想要发送给您的地方..

我正在思考的是你改变了链接结构,但没有添加.htaccess更改。

感谢。