Redirect of search ends up in a 404 page sometimes.

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Redirect of search ends up in a 404 page sometimes.

This topic contains 2 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 6 years, 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #17167
    Fredag
    Fredag
    Participant

    Hello

    I have a search field on front-page witch is supposed to redirect to the main search page and there display the result. It works when I don´t enter any search phrase or if I enter one letter or two letters but with three letters or more I get redirected to a 404 page. But phrases like ?s=ease works but not ?s=lease (I have a post with a title like “Test Release”).

    The search criteria is to search in title and custom field general_description.

    I use a child theme and the parent is Divi-theme.

    Question no 2:

    Is it also possible to have a redirect when a user chooses a category from the category dropdown?

    /Stefan

    #17170
    Fredag
    Fredag
    Participant

    Hello

    Regarding question 1. I solved it by using a get querystring on the second page (search) like:
    $frontpagesearch = sanitize_text_field( $_GET[‘frontpagesearch’] );

    And with JavaScript ad it to the search bar on the search page (second page).

    I will try to do something similar with question no 2.
    Still curious to here what you have to say about my original question though.

    /Stefan

    #17174
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Stefan!

    1. I am thinking that the results override feature might not be enabled. In that case, the plugin will simply redirect to the results page, but will not override the search results with it’s own.

    2. Might be possible actually, with a custom API javascript call. I have constructed a custom code, which may do the trick for you. The $page_id variable should be set to the page where this should be effective. In your case I think it’s 27915, but make sure to check it.

    Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


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

You must be logged in to reply to this topic.