Hi there,
does the error provide more details such as a stack trace?
which would normally show what functions were being called up to the point of the error occurring.
Hi David,
It doesn’t provide any other information. The only stack trace I found in the error log was from September last year.
Hi David,
The error provides no additional details. The only stack trace I found was from September last year.
Hi @dukearmi,
I see. It would be hard to determine the cause of the error with no additional details.
How are you adding your custom functions? Have you tried removing them temporarily?
Can you also check if your post-meta.php is the same as this?: https://github.com/tomusborne/generatepress/blob/master/inc/structure/post-meta.php
Hi Fernando,
I’m adding the custom fucntions with PHP code using the Code Snippets plugin. I haven’t tried removing it because it would mess with the post meta on the frontend. Here’s the code if it helps:
add_filter( 'generate_post_date_output', function( $output, $time_string ) {
$time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">Published on %2$s</time>';
$updated_time = get_the_modified_time( 'U' );
$published_time = get_the_time( 'U' );
if ( $updated_time > $published_time ) {
$time_string = '<time class="entry-date updated-date" datetime="%3$s" itemprop="dateModified">Updated on %4$s</time>';
}
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() )
);
return sprintf( '<span class="posted-on">%s</span> ',
$time_string
);
}, 10, 2 );
add_filter( 'generate_post_author_output', function() {
return sprintf( ' <span class="byline">%1$s</span>',
sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%4$s<a href="%1$s" title="%2$s" rel="author"><span class="author-name" itemprop="name">%3$s</span></a></span>',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( '', 'generatepress' ), get_the_author() ) ),
esc_html( get_the_author() ),
get_avatar( get_the_author_meta( 'ID' ) )
)
);
} );
add_filter( 'author_link', function( $link, $author_id ) {
if ( 1 === $author_id ) {
return 'https://www.example.com/author';
}
return $link;
}, 10, 2 );
add_filter( 'generate_header_entry_meta_items', function() {
return array(
'author',
'date',
);
} );
/*
add_action( 'generate_after_header', function()
{
if ( is_single() ) {
if (function_exists('rank_math_the_breadcrumbs'))
{
rank_math_the_breadcrumbs();
}
}} );
*/
add_filter( 'generate_show_title', '__return_false' );
add_action( 'generate_after_header', function() {
if ( ! is_front_page() && ! is_archive() ) {
the_title( '<h1 class="entry-title" itemprop="headline">', '</h1>' );
}} );
add_filter( 'generate_footer_entry_meta_items', '__return_null' );
The last line of code has “return_null” in it so it might have something to do with the error.
I used a text compare tool and it showed that my post-meta.php is the same as the one in the link your povided (no changes).
Try removing:
add_filter( 'generate_footer_entry_meta_items', '__return_null' );
And use this code instead to remove the footer meta:
add_action( 'wp', function() {
remove_action( 'generate_after_entry_content', 'generate_footer_meta' );
} );
Hi David,
Thank you very much! I’ll follow your advice and report if it resolves the issue in the next few days.
@diggeddy I’m happy to report that I haven’t seen the error for the past 3 days! Thank you so much for your help π