Support » Plugin: Highlight Search Terms » Clashes with Gravity Forms

  • Edit: Seems to work reasonably now.


    For some reason the code for this plugin is run in an ajax call for modifying Gravity Forms in the backend. It causes the following error

    PHP Fatal error: Uncaught Error: Call to a member function get() on null in domain/public_html/wp-includes/query.php:28
    Stack trace:
    #0 domain/wp-content/plugins/bbpress/includes/common/template.php(2036): get_query_var(‘_bbp_query_name’)
    #1 domain/wp-content/plugins/bbpress/includes/common/template.php(2024): bbp_get_query_name()
    #2 domain/wp-content/plugins/bbpress/includes/common/template.php(809): bbp_is_query_name(‘bbp_search’)
    #3 domain/wp-content/plugins/highlight-search-terms/hlst.php(97): bbp_is_search()
    #4 domain/wp-includes/class-wp-hook.php(298): HighlightSearchTerms::add_url_filters(Object(WP_Query))
    #5 domain/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters(NULL, Array)
    #6 domain/wp-includes/plugin.php(515): WP_Hook->do_action(Array)

    • This topic was modified 1 year, 2 months ago by  dicoeenvoud. Reason: Altered review for new version
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author RavanH


    Hi dico, is this a review or are you asking for help with your specific setup? I notice you have bbpress running as well. Can you provide more info about when/where is is occurring, I might be able to provide a fix…

    For this client we are running a multisite with several plugins. Most recently we added bbpress and bbp private groups. After that, when in the backend, going to “Forms” (from Gravity Forms), and adding any field to a new form, will result in this error. I am unsure why it would even attempt to intercept an ajax call from a different plugin entirely, in the backend, if it is supposed to highlight search terms in the frontend.

    Plugin Author RavanH


    Highlight Search Terms adds a parse_query filter and then tests for a bbp_is_search() to know if the request was for a bbPress search. The parse_query filters are normally only run on front end requests.

    I have absolutely no idea why in your setup this would happen on the admin side. This is not normal WordPress behavior as far as I know. But even then, the bbp_is_search() conditional should simply return false and nothing should happen…

    Still, you could test a small modification that should prevent the bbp_is_search check ever be reached on the admin side if you like:

    Open the file hlst.php in your WordPress plugin editor and find the function add_url_filters() about half way down the file. In there, there is this line:

    if ( function_exists('bbp_is_search') && bbp_is_search() ) {

    Now append a !is_admin() && to that if statement so it looks like this:

    if ( !is_admin() && function_exists('bbp_is_search') && bbp_is_search() ) {

    Then save the file and test again… If the problem persists, check the error log. There should be no more mention like “#3 domain/wp-content/plugins/highlight-search-terms/hlst.php(97): bbp_is_search()” in there.

    This did indeed fix the issue: I would suggest adding the following code to the top of the function instead to not trigger on ajax requests:

                    if ( is_admin() || (defined( 'DOING_AJAX' ) && DOING_AJAX) ) {
    Plugin Author RavanH


    I’m til unclear about why parse_query is run on the admin on your setup. I’ve got a site on a multisite with both bbPress and Highlight Search Terms activated and there is no issue at all. It must be Gravity Forms that invokes a new WP_Query and most likely is doing it wrong. That, in combination with a missing bbPress class that is called on by its own function bbp_is_search()… Seems unfair to rate the third plugin one star for this.

    Still, good to know this can happen. I’ll put the extra checks in the next version. Thanks for your feedback.

    Hi @dicoeenvoud,
    as @ravanh wrote, rating his plugin 1 star seems a bit unfair to me. He responded extremely fast (and helpful) and released a patch in no time.

    In my opinion, writing a support thread would have been the better way to handle this. Please consider changing this review’s amount of stars.


    This plugin lacked ratings and I have rated it as it was just then. I’ll revisit my review when I have a chance of reviewing the patch, to see if it fixed the issue in that installation.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Clashes with Gravity Forms’ is closed to new replies.