Anything else, can you get the full error call stack? That’s a reference to WP core files, so I have no idea of telling how that is related to Relevanssi. The function the error relates to (sanitize_post_field()) is something Relevanssi doesn’t use directly.
Have you tried a different theme, like one of the default themes? Does the error appear with the default theme?
Thank you for your reply.
This is the only error displayed. The same errors will be displayed at the beginning of the page consecutively as many as the number of search results.
I am using a custom theme on a running website, so I can not see the default theme right now.
search.php is very simple:
<?php get_header(); ?>
<?php if ( have_posts() ) : ?>
<header class="page-header">
<?phpthe_archive_title( '<h1 class="page-title">', '</h1>' );?>
</header><!-- .page-header -->
<?php
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/content', 'search' );
endwhile;
the_posts_pagination();
else :
get_template_part( 'template-parts/content', 'none' );
endif;
?>
<?php get_footer(); ?>
/template-parts/content-search.php:
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if( has_post_thumbnail() ): ?>
<div class="entry-thumbnail">
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail(); ?>
</a>
</div><!-- .entry-thumbnail -->
<?php endif; ?>
<header class="entry-header">
<?php the_title( sprintf( '<h2 class="entry-title"><a href="%s">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
<p class="entry-date"><?php the_time(get_option('date_format')); ?></p>
</header><!-- .entry-header -->
<div class="entry-content">
<?php the_excerpt(); ?>
</div><!-- .entry-content -->
</article><!-- #post-## -->
Removing get_header() and get_footer() did not change the result.
Unchecking “Create custom search result snippets” the error goes away.
<?phpthe_archive_title( '<h1 class="page-title">', '</h1>' );?> is a mistake of copy-and-paste, <?php the_archive_title( '<h1 class="page-title">', '</h1>' );?> is right.
You can preview themes with “Live Preview” without activating them. There’s nothing problematic with your current theme though, it’s perfectly standard theme.
Is “Use custom field content for building excerpts” enabled? If it is, does disabling it remove the errors?
With the full call stack, it’d be easier to say what’s wrong, but if it’s not available, I’m pretty much guessing here.
When I tested the search while previewing the TwentyNineteen theme with “Create custom search result snippets” checked, no errors occurred.
And when I tested it again while previewing the custom theme, no errors occurred.
Nothing has changed except for the theme preview!
I apologize for taking time.
The plugin works great now!