Pagination not working with custom search slug

  • prakashreddy.imduri
    Participant
    1 year ago #31078

    Hi, I have a custom slug domain.name/search/?s= to my search page, All features are working but pagination is not working with this slug, but its working with domain.name/?s= . Can you help me to fix the issue for pagination?

    wpsolr
    Keymaster
    1 year ago #31081

    It could be that pagination elements are different on both pages, and that on one page WPSOLR cannot find them for refreshing the display after selection.
    You can tweak the pagination elements css selector on the “Theme” add-on?

    prakashreddy.imduri
    Participant
    1 year ago #31082

    we are using this function for slug rewrite
    function wpb_change_search_url() {
    if ( is_search() && ! empty( $_GET[‘s’] ) ) {
    wp_redirect( home_url( “/search/” ) . urlencode( get_query_var( ‘s’ ) ) );
    exit();
    }
    }
    add_action( ‘template_redirect’, ‘wpb_change_search_url’ );

    Ajax is getting sent, but still no results or page number is changing

    wpsolr
    Keymaster
    1 year ago #31085

    Ajax is getting sent, but still no results or page number is changing

    See my previous answer on tweaking the pagination elements css selector on WPSOLR’s “Theme” add-on

    prakashreddy.imduri
    Participant
    1 year ago #31086

    All css selectors are fine, bcos the ajax and pagination is working without that function wpb_change_search_url()

    wpsolr
    Keymaster
    1 year ago #31087

    How did you build your “/search/” ?

    prakashreddy.imduri
    Participant
    1 year ago #31089

    there is no page for it in backend , its just an url rewrite for the wordpress search functionalityz. we are not using any shortcode. the function just adds /search/ to ?s in url…
    its a custom slug for wordpress default search

    wpsolr
    Keymaster
    1 year ago #31090

    It does not look like a rewrite, but a redirection (use of wp_redirect). But a redirection to what?

    Be aware that WPSOLR replaces archives queries. If “/search/” is not the search archive, it will not work as expected.

    prakashreddy.imduri
    Participant
    1 year ago #31092

    I just wanted to display search url as domain.name/search/?s= instead of the default domain.name/?s=, That function worked, but only problem is the pagination when /search/ is present in url.

    wpsolr
    Keymaster
    1 year ago #31095

    You need to discover what is the permalink /search/: a page, the search archive template, other?

    prakashreddy.imduri
    Participant
    1 year ago #31096

    the same code is working without any issue without wpsolr, but after activating plugin, there is pagination issue. Can you try this and let me know

    function wpb_change_search_url() {
    if ( is_search() && ! empty( $_GET[‘s’] ) ) {
    wp_redirect( home_url( “/search/” ) . urlencode( get_query_var( ‘s’ ) ) );
    exit();
    }
    }
    add_action( ‘template_redirect’, ‘wpb_change_search_url’ );

    wpsolr
    Keymaster
    1 year ago #31097

    I tested your code, but pagination works fine on my environments.

    prakashreddy.imduri
    Participant
    1 year ago #31106

    How can I make this url work : /store/?s= to /store/search/?s=
    Can you pls guide

    wpsolr
    Keymaster
    1 year ago #31108

    /store/ is not a WooCommerce url that I know of. Is it from your theme?

Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.