custom post types - Woocommerce search pagination not working

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

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>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745566771a4633440.html

相关推荐

  • custom post types - Woocommerce search pagination not working

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

    6小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信