admin管理员组

文章数量:1430860

I have a problem with the Woocommerce Pagination but only on the Search Page. On category sites the pagination links are working just fine.

But on the Search Page the pagination generates links like this:

"/page/2/?s=adalya&post_type=product"

Even though this url does not work but it displays the root url of my domain and does not generate a 404 not found error.

I would like to change the whole search URL structure to something like:

"/search/search-query/2"

My Pagination links

<nav class="woocommerce-pagination">
    <?php
        $pages = paginate_links( apply_filters( 'woocommerce_pagination_args', array( // WPCS: XSS ok.
            'base'      => $base,
            'format'    => $format,
            'add_args'  => false,
            'current'   => max( 1, $current ),
            'total'     => $total,
            'prev_text' => '<i class="icon-angle-left"></i>',
            'next_text' => '<i class="icon-angle-right"></i>',
            'type'      => 'array',
            'end_size'  => 3,
            'mid_size'  => 3,
        ) ) );

        if ( is_array( $pages ) ) {
            $paged = ( get_query_var( 'paged' ) == 0 ) ? 1 : get_query_var( 'paged' );
            echo '<ul class="page-numbers nav-pagination links text-center">';
            foreach ( $pages as $page ) {
                $page = str_replace( 'page-numbers', 'page-number', $page );
                echo '<li>' . $page . '</li>';
            }
            echo '</ul>';
        }
    ?>
</nav>
</div>

本文标签: custom post typesWoocommerce search pagination not working