• Resolved mkdev

    (@mkdev)


    I get this error, when I try to edit the page that contains the search block. (when I have Live search plugin active)

    The plugin works on the frontend without issue, just when I edit that specific page is triggerd.

    Fatal error: Uncaught TypeError: Argument 1 passed to Relevanssi_Live_Search_Form::modify_search_form() must be of the type string, null given, called in /public_html/wp-content/plugins/relevanssi-live-ajax-search/includes/class-relevanssi-live-search-form.php on line 173 and defined in /public_html/wp-content/plugins/relevanssi-live-ajax-search/includes/class-relevanssi-live-search-form.php:182 Stack trace: #0 /public_html/wp-content/plugins/relevanssi-live-ajax-search/includes/class-relevanssi-live-search-form.php(173): Relevanssi_Live_Search_Form->modify_search_form(NULL) #1 /public_html/wp-includes/class-wp-hook.php(309): Relevanssi_Live_Search_Form->render_block(NULL, Array) #2 /public_html/wp-includes/plugin.php(191): WP_Hook->apply_filters(NULL, Array) #3 /public_html/wp-includes/class-wp-bl in/public_html/wp-content/plugins/relevanssi-live-ajax-search/includes/class-relevanssi-live-search-form.php on line 182

    • This topic was modified 2 years, 5 months ago by mkdev.
    • This topic was modified 2 years, 5 months ago by mkdev.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mikko Saari

    (@msaari)

    I tried reproducing this problem, but I cannot. I can edit a page with a search form block without problems. Looks like the function in Relevanssi Live Ajax Search that edits the search form is getting a null value when it should get a string that contains the search form HTML. Is it possible some third party is interfering here?

    Anyway, for a fix, I was thinking of modifying the render_block() function in /wp-content/plugins/relevanssi-live-ajax-search/includes/class-relevanssi-live-search-form.php to this:

    public function render_block( $block_content, $block ) {
    	if ( ! $block_content || is_admin() || 'core/search' !== $block['blockName'] ) {
    		return $block_content;
    	}
    	$block_content = $this->modify_search_form( $block_content );
    	return $block_content;
    }

    This should fix the problem.

    Thread Starter mkdev

    (@mkdev)

    @msaari modifying the render_block does the job! (no more error when editing)

    It could a third-party interference in my case (it’s not a fresh install), but I haven’t drilled down to find the one causing it.

    • This reply was modified 2 years, 5 months ago by mkdev.
    Plugin Author Mikko Saari

    (@msaari)

    Ok, very good. I’ll include this fix in the next version of the plugin.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Fatal error when editing page’ is closed to new replies.