Archived topic
White screen when trying to add/edit posts after updating to Wordpress 5.7
7 replies · Started by Jenni on March 11, 2021
I am using GeneratePress premium with a child theme. Since updating to Wordpress 5.7 I cannot add or edit any posts or pages as I just get a white screen.
When I switch the theme to GeneratePress it works fine, but the child theme is breaking it.
I have tried disabling all plugins and clearing cache but this doesn't help.
What should I do?
Thanks!
Hi there,
do you have any Custom Functions in your Child Theme ?
I think so. I've just looked in /generatepress_child/functions.php and it has some things in there.
Can you reply with the code in the normal editor (the private info doesn't support that). before submitting the code, highlight the code and click the code button.
Here's the code inside /generatepress_child/functions.php ...
<?php
/**
* GeneratePress child theme functions and definitions.
*
* Add your custom PHP in this file.
* Only edit this file if you have direct access to it on your server (to fix errors if they happen).
*/
/* DISABLE DASHICONS */
function wpdocs_dequeue_dashicon() {
if (current_user_can( 'update_core' )) {
return;
}
wp_deregister_style('dashicons');
}
add_action( 'wp_enqueue_scripts', 'wpdocs_dequeue_dashicon' );
/* REMOVE QUERY STRING */
function remove_cssjs_ver( $src ) {
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 );
add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );
/* REMOVE NOREFERRER FROM LINKS */
function my_targeted_link_rel($rel_values) {
return 'noopener';
}
add_filter('wp_targeted_link_rel', 'my_targeted_link_rel',999);
/* DISABLE EMBEDS */
function disable_embed(){
wp_dequeue_script( 'wp-embed' );
}
add_action( 'wp_footer', 'disable_embed' );
/* DISABLE XML-RPC */
add_filter('xmlrpc_enabled', '__return_false');
/* REMOVE WLMANIFEST LINK */
remove_action( 'wp_head', 'wlwmanifest_link' ) ;
/* REMOVE LINKS FROM COMMENTS */
if ( ! function_exists( 'generate_comment' ) ) {
/**
* Template for comments and pingbacks.
*
* Used as a callback by wp_list_comments() for displaying the comments.
*/
function generate_comment( $comment, $args, $depth ) {
$args['avatar_size'] = apply_filters( 'generate_comment_avatar_size', 50 );
if ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) : ?>
<li id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>
<div class="comment-body">
<?php _e( 'Pingback:', 'generatepress' ); // WPCS: XSS OK. ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( 'Edit', 'generatepress' ), '<span class="edit-link">', '</span>' ); ?>
</div>
<?php else : ?>
<li id="comment-<?php comment_ID(); ?>" <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?>>
<article id="div-comment-<?php comment_ID(); ?>" class="comment-body" itemscope itemtype="https://schema.org/Comment">
<footer class="comment-meta">
<?php
if ( 0 != $args['avatar_size'] ) {
echo get_avatar( $comment, $args['avatar_size'] );
}
?>
<div class="comment-author-info">
<div class="comment-author vcard" itemprop="author" itemscope itemtype="https://schema.org/Person">
<?php printf( '<cite itemprop="name" class="fn">%s</cite>', get_comment_author() ); ?>
</div><!-- .comment-author -->
<div class="entry-meta comment-metadata">
<time itemprop="datePublished">
<?php printf( // WPCS: XSS OK.
/* translators: 1: date, 2: time */
_x( '%1$s', '1: date, 2: time', 'generatepress' ),
get_comment_date()
); ?>
</time>
<?php edit_comment_link( __( 'Edit', 'generatepress' ), '<span class="edit-link">| ', '</span>' ); ?>
<?php
comment_reply_link( array_merge( $args, array(
'add_below' => 'div-comment',
'depth' => $depth,
'max_depth' => $args['max_depth'],
'before' => '<span class="reply">| ',
'after' => '</span>',
) ) );
?>
</div><!-- .comment-metadata -->
</div><!-- .comment-author-info -->
<?php if ( '0' == $comment->comment_approved ) : ?>
<p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'generatepress' ); // WPCS: XSS OK. ?></p>
<?php endif; ?>
</footer><!-- .comment-meta -->
<div class="comment-content" itemprop="text">
<?php comment_text(); ?>
</div><!-- .comment-content -->
</article><!-- .comment-body -->
<?php
endif;
}
}
Nothing in there stands out as if it would be an issue.
First off - if you temporarily remove them all from the functions.php can you edit the site?
If so then paste each function back one at a time to to see which is causing the conflict.
Got it! It was this one...
/* REMOVE QUERY STRING */
function remove_cssjs_ver( $src ) {
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 );
add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );
I've taken that bit out and it works! Thanks so much.
Glad to hear you found the issue - removing query strings can be a pain when it comes to caching files, it doesn't actually make any speed improvements - so thanks for sharing that as being the problem!