Wordpress paging issues

0

Good evening. I am having problems with paging in wordpress. I use custom link like this - > /% category% /% postname%

I have a page called a blog. When I put the pagination in it it works correctly but when I put it in the search page by category (category / politics) of the error. It seems to be a page fault not found and instead of going to the second page it goes to home.

When I access the page listing page the url looks like this: mydomain.dev/blog and the right pagination works. url with pagination mydomain.dev/blog/page/2

But when I access the category page, where I search the posts by category, the url looks like this: mydomain.dev/category/policy and the error. url with pagination yourdomain.dev/category/policy/page/2.

My pagination function:

function my_paginate_links() {
    global $wp_rewrite, $wp_query;
    $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;
    $pagination = array(
        'base' => @add_query_arg('page','%#%'),
        'format' => '',
        'total' => $wp_query->max_num_pages,
        'current' => $current,
        'prev_text' => __('«'),
        'next_text' => __('»'),
        'end_size' => 1,
        'mid_size' => 2,
        'show_all' => true,
        'type' => 'list'
    );
    if ( $wp_rewrite->using_permalinks() )
        $pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'page/%#%', 'paged' );

    if ( !empty( $wp_query->query_vars['s'] ) )
        $pagination['add_args'] = array( 's' => get_query_var( 's' ) );

    echo paginate_links( $pagination );
}

The category page:

            $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

            $taxQuery = array(
                array(
                    'taxonomy' => 'category',
                    'field' => 'slug',
                    'terms' => $category
                )
            );

            /*$args = array(
                'post_type' => 'post',
                'tax_query' => $taxQuery,
                'posts_per_page' => 1, 
                'paged' => $paged
            );*/

            query_posts(
                array(
                    'post_type' => 'post',
                    'tax_query' => $taxQuery,
                    'posts_per_page' => 1, 
                    'paged' => $paged
                )
            );

Can anyone help me?

Att, Mauritius.

    
asked by anonymous 16.01.2018 / 03:11

0 answers