Wrong paging count in wordpress

0

When the slug stored in var $ type is for example 'salty pizzas' the page scrolls normally, now when this slug changes, the paging appears even without the need to appear, with several blank pages. It's like you're counting all the results for all slug's.

Query and Loop     

    $argsProdutos = array ( 
        'post_type'     => 'cardapios',
        'post_status'   => 'published',
        'orderby'       => 'name',
        'order'         => 'ASC',
        'tax_query'     => array(
                        array(
                        'taxonomy' => $taxonomy,
                        'field' => 'slug',
                        'terms' => $tipo
                        )
        ),
        'paged' => $paged 
    );

    $produto = new WP_Query( $argsProdutos );

    // THE LOOP
    if ( $produto->have_posts() ) : while ( $produto->have_posts() ) : $produto->the_post(); 

?>

    <!-- EXAMPLE -->
    <h1><?php the_title();?></h1>

<?php

    endwhile; wp_reset_query();

    endif;

    pagination_links();

?>

Paging

function pagination_links() {

        global $wp_query;
        $total = $wp_query->max_num_pages;

        if ( $total > 1 )  {

            if ( !$current_page = get_query_var('paged') )
                $current_page = 1;

                $big = 999999999;

                $permalink_structure = get_option( 'permalink_structure' );
                $format = empty( $permalink_structure ) ? '&page=%#%' : 'page/%#%/';

                echo '<div class="pagination">';
                    echo paginate_links( array(
                        'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
                        'format' => $format,
                        'current' => $current_page,
                        'total' => $total,
                        'mid_size' => 4,
                        'type' => 'plain'
                    ));
                echo '</div>';
            }

    }
    
asked by anonymous 12.11.2015 / 03:46

0 answers