• Resolved hokua

    (@hokua)


    When checking “Create custom search result snippets”, a search page with results removes the footer – get_footer() – and also kills all JS. When there are no results, the footer and site appears as expected.

    I can’t seem to find any other example of this in the forums.

    Using WordPress 6.2.2, PHP 8.1.9, custom _tw theme

    Has anyone else experienced this?

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

    (@msaari)

    This sounds like an error situation. Something in your posts causes the excerpt-building to trigger a fatal error. Your server PHP error log may provide some clue to what is happening.

    Does this happen always for all searches?

    Thread Starter hokua

    (@hokua)

    Thanks, Mikko. This does happen always for any search that yields results. If there are no results, then it doesn’t happen. A couple of things I’ve tested since I last wrote:

    • I checked the error log. The only thing in there is the following notice: Passing null to parameter #1 ($string) of type string is deprecated in [project-name]/wp-includes/formatting.php on line 2809. That error goes away if I try to downgrade to a 7.x version of PHP.
    • Tested the removal of the while loop that includes the_post() and the_excerpt() from the template if it has results and replaced it with a simple string that states “You have results.” It still happens.

    I’m sort of at a loss for the time being. I’ll keep pushing on my end to see if I find a solution.

    One thing I didn’t mention earlier – I’m building the site using ACF Blocks. Not sure if that plays a part but figured I’d bring it up.

    Does anything I’ve mentioned here sound odd to you?

    • This reply was modified 1 year, 4 months ago by hokua.
    Plugin Author Mikko Saari

    (@msaari)

    ACF Blocks may well be a part of the problem. If this issue comes up with any search results, it’s related to something in all posts. What if you blank out the post content?

    add_filter( 'relevanssi_excerpt_content', function( $content ) {
      return '';
    } );

    Do you still get the error?

    Thread Starter hokua

    (@hokua)

    I still got the error when adding the filter, but you led me to believe it is due to content in ACF Blocks. So I did some testing, and it was, but the error was on my end. A duplicate get_footer() in one of the blocks was killing the footer. That’ll do it.

    Long story short: problem solved. Sorry for taking your time, and thank you for leading me in the right direction.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom Excerpts w/Results Removes Footer’ is closed to new replies.