After updating the WordPress Theme on a customers website, I was shown a white screen with the line:
Can’t use function return value in write context in /wp-content/themes/
jupiter/dynamic–styles/global/header.php on line 346
Luckily I had just made a copy of the theme before updating it. Later on, during a time when no one would be visting the site I went back to look at it and fix the issue.
The original code line was:
$logo_width = !empty( get_post_meta( $post_id, ‘logo_width’, true ) ) ? get_post_meta( $post_id, ‘logo_width’, true ) : ”;
Change it to:
$test_logo_width = get_post_meta( $post_id, ‘logo_width’, true );
$logo_width = !empty( $test_logo_width ) ? $test_logo_width : ”;
This type of code will happen 3 more times in that file, and you have to change them all to be of similar structure.
#2:
$light_logo_width = ! empty( get_post_meta( $post_id, ‘light_logo_width’, true ) ) ? get_post_meta( $post_id, ‘light_logo_width’, true ) : ”;
Change to:
$test_light_logo_width = get_post_meta( $post_id, ‘light_logo_width’, true );
$light_logo_width = ! empty( $test_light_logo_width ) ? $test_light_logo_width : ”;
#3:
$sticky_logo_width = ! empty( get_post_meta( $post_id, ‘sticky_header_logo_width’, true ) ) ? get_post_meta( $post_id, ‘sticky_header_logo_width’, true ) : ”;
Change to:
$test_sticky_logo_width = get_post_meta( $post_id, ‘sticky_header_logo_width’, true );
$sticky_logo_width = ! empty( $test_sticky_logo_width ) ? $test_sticky_logo_width : ”;
#4:
$mobile_logo_width = ! empty( get_post_meta( $post_id, ‘responsive_logo_width’, true ) ) ? get_post_meta( $post_id, ‘responsive_logo_width’, true ) : ”;
Change to:
$test_mobile_logo_width = get_post_meta( $post_id, ‘responsive_logo_width’, true );
$mobile_logo_width = ! empty( $test_mobile_logo_width ) ? $test_mobile_logo_width : ”;