Search results not working for a sub page

  • anant
    Participant
    5 years ago #11708

    Hi,

    I have a search box on a subpage [<index page url)/course-category/team] but when a user searches for a keyword, the result URLs is <index page url>/?s=data&ref=course where as expectation is <index page url>/course-category/team?s=data&ref=course.
    This works fine when we manually edit the URL. Could you tell me why is this error happening and how can we fix this?

    anant
    Participant
    5 years ago #11709

    Also, when a user clears the search keyword and clicks the search to all the items, it throws an error

    “Fatal error: Uncaught Error: Call to a member function get_image() on boolean in /nas/content/staging/anantlms/wp-content/plugins/learnpress/templates/loop/course/thumbnail.php:22 Stack trace: #0 /nas/content/staging/anantlms/wp-content/plugins/learnpress/inc/lp-template-functions.php(2511): include() #1 /nas/content/staging/anantlms/wp-content/plugins/learnpress/inc/lp-template-functions.php(1358): learn_press_get_template(‘loop/course/thu…’) #2 [internal function]: learn_press_courses_loop_item_thumbnail(”) #3 /nas/content/staging/anantlms/wp-includes/class-wp-hook.php(286): call_user_func_array(‘learn_press_cou…’, Array) #4 /nas/content/staging/anantlms/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(”, Array) #5 /nas/content/staging/anantlms/wp-includes/plugin.php(465): WP_Hook->do_action(Array) #6 /nas/content/staging/anantlms/wp-content/plugins/learnpress/templates/content-course.php(37): do_action(‘learn-press/cou…’) #7 /nas/content/staging/anantlms/wp-includes/template.php(706): require(‘/nas/co in /nas/content/staging/anantlms/wp-content/plugins/learnpress/templates/loop/course/thumbnail.php on line 22″

    wpsolr
    Keymaster
    5 years ago #11712

    Could you tell me why is this error happening and how can we fix this?

    You search box decides to redirect the search to the standard search page yoursite.com/?s=
    You’ll have to change the search box form action to redirect the search to the same category instead.

    Fatal error: Uncaught Error: Call to a member function get_image() on boolean in /nas/content/staging/anantlms/wp-content/plugins/learnpress/templates/loop/course/thumbnail.php:22

    We did not test LearnPress with WPSOLR.

    anant
    Participant
    5 years ago #11718

    Thanks for the quick response.

    You’ll have to change the search box form action to redirect the search to the same category instead.

    Could you explain how this can be done? Any document/ reference to go through step-by-step to implement this?

    Also, Is there any way to disable the WPSolr search feature for a search box used in the whole web application?

    wpsolr
    Keymaster
    5 years ago #11720

    Any document/ reference to go through step-by-step to implement this?

    If your form is standard, you can try to use the filter https://developer.wordpress.org/reference/hooks/get_search_form/

    disable the WPSolr search feature for a search box used in the whole web application?

    WPSOLR replaces the standard search url “/?s”, not the search boxes.

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

You must be logged in to reply to this topic.