• Resolved devwam

    (@devwam)


    Hi,

    I have a problem that makes me crazy. I hope you can help me to fix it 🙂

    The search works good, BUT when I try with the term “life”, it crashes…

    There is one page with the name “Life NaturArmy” and another with the term “life” in the content.

    I tried to use the Relevanssi admin search but the problem is still there. Here is some things I finded with the admin search:

    • Term “life”, post type “all”, posts per page “all” => CRASH
    • Term” life”, post type “page” (or another specific post type), posts per page “all” => OK
    • Term “life”, post type “all”, posts per page “10” => OK
    • Term “test”, post type “all”, posts per page “all” => OK

    I tried to delete the page but nothing change.

    If you have any idea, I’ll take it!

    WP version: 6.1.1
    Relevanssi version: 4.18.2

    Thanks for your help 🙏

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Can you find out the exact error message that gets reported when the site crashes? There should be something in the server PHP error logs. That would solve this problem.

    Does it help if you disable custom excerpts in the Relevanssi settings?

    Thread Starter devwam

    (@devwam)

    I have an error 500 in the console log, and on the front I got this:

    Fatal error: Uncaught Error: Object of class WP_Post could not be converted to string
    in [...]/wp-includes/kses.php on line 1686

    Does it help if you disable custom excerpts in the Relevanssi settings?

    No, it doesn’t help

    Plugin Author Mikko Saari

    (@msaari)

    Can you get the full stack trace of the error, so I could see how it is related to Relevanssi? That message is, unfortunately, so generic that it doesn’t help.

    Thread Starter devwam

    (@devwam)

    Here is:

    Pile d’appel :
    
        preg_replace()
        wp-includes/kses.php:1686
        wp_kses_no_null()
        wp-includes/kses.php:718
        wp_kses()
        wp-content/plugins/display-a-meta-field-as-block/meta-field-block.php:70
        meta_field_block_render_block()
        wp-includes/class-wp-block.php:256
        WP_Block::render()
        wp-includes/class-wp-block.php:242
        WP_Block::render()
        wp-includes/class-wp-block.php:242
        WP_Block::render()
        wp-includes/class-wp-block.php:242
        WP_Block::render()
        wp-includes/class-wp-block.php:242
        WP_Block::render()
        wp-includes/blocks/post-template.php:95
        render_block_core_post_template()
        wp-includes/class-wp-block.php:256
        WP_Block::render()
        wp-includes/class-wp-block.php:242
        WP_Block::render()
        wp-includes/blocks.php:1051
        render_block()
        wp-includes/blocks.php:1089
        do_blocks()
        wp-includes/class-wp-hook.php:308
        WP_Hook::apply_filters()
        wp-includes/plugin.php:205
        apply_filters()
        wp-content/plugins/relevanssi/lib/excerpts-highlights.php:138
        relevanssi_do_excerpt()
        wp-content/plugins/relevanssi/lib/excerpts-highlights.php:1548
        relevanssi_add_excerpt()
        wp-content/plugins/relevanssi/lib/search.php:694
        relevanssi_do_query()
        wp-content/plugins/relevanssi/lib/search.php:84
        relevanssi_query()
        wp-includes/class-wp-hook.php:308
        WP_Hook::apply_filters()
        wp-includes/plugin.php:256
        apply_filters_ref_array()
        wp-includes/class-wp-query.php:3097
        WP_Query::get_posts()
        wp-includes/class-wp-query.php:3749
        WP_Query::query()
        wp-includes/class-wp.php:663
        WP::query_posts()
        wp-includes/class-wp.php:783
        WP::main()
        wp-includes/functions.php:1332
        wp()
        wp-blog-header.php:16
        require()
        index.php:17

    I use the plugin “Meta Field Block” to display ACF’s field but I use this code to block his interpretation:

    add_filter( 'relevanssi_block_to_render', 'rlv_no_core_image_blocks' );
    function rlv_no_core_image_blocks( $block ) {
      if ( 'mfb/meta-field-block' === $block['blockName'] ) {
        return null;
      }
      return $block;
    }
    Plugin Author Mikko Saari

    (@msaari)

    Indeed, this points at there being a problem with this particular block in the Relevanssi excerpts. The problem should go away if you disable the Relevanssi custom excerpts, though. What’s the stack trace like when you get this error with Relevanssi excerpts disabled?

    The relevanssi_block_to_render filter hook is only applied in indexing; Relevanssi in general doesn’t explicitly render blocks in excerpt-building. As you can see in the stack trace, the block rendering starts with apply_filters().

    One solution to this would be to add a filter on relevanssi_pre_excerpt_content to remove the block from the post content before Relevanssi runs apply_filters() to expand it.

    Thread Starter devwam

    (@devwam)

    Oh! My bad, I was looking at the wrong setting.

    Indeed, if I uncheck this parameter, the search works!

    Thanks a lot for your rapidity and your advices!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Issue with a specific term’ is closed to new replies.