Search pagination link | WordPress.org

In the base link, %_% is replaced with the base argument, so you cannot simply append it to an URL with a query string (the ?s=a). Instead search the URL for ? and replace it with %_%?. Generally speaking anyway, be sure to correctly manage the slashes, you don’t want missing or double slashes.

Hi,

Sorry, I don’t get what you meant.

Are you able to rewrite that pagination code?

I got the solution! I just created a new page called /find/ instead of using the main search page since I need to pass more parameters and it was giving me a 404 error. Below is the solution if someone needs it.

if($r->max_num_pages > 1){
                                echo "<div class='pagination'>".paginate_links(array(
                                    'base' =>  '/find/%_%',
                                    'format' => 'page/%#%',
                                    'current' => max(1, get_query_var('paged')),
                                    'total' => $r->max_num_pages,
                                    'type'            => 'plain',
                                    'add_args'        => false,
                                    'prev_text'    => __('<i class="fas fa-arrow-left"></i>'),
                                    'next_text'    => __('<i class="fas fa-arrow-right"></i>'),
                                ));
                                echo "</div>";
                            }



Source link