Archived topic
Possible error/notice found in 'generate-menu-plus.php'
3 replies · Started by Simon on December 10, 2021
I've come across a PHP error in 'generate-menu-plus.php':
'Trying to access array offset on value of type bool in /config/www/wp-content/plugins/gp-premium/menu-plus/functions/generate-menu-plus.php on line 2052'
It has only just started appearing, and don't know what I've changed to cause it. Could it be a change of PHP version ?
The 'wp_get_attachment_image_src()' function can return false, and then the [0] array index on line 2052 throws an error.
A fix is to move line 2052 below the 'if' statement on line 2055.
$logo_url = wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), 'full' );
2052--> $logo_url = esc_url( apply_filters( 'generate_logo', $logo_url[0] ) );
$retina_logo_url = esc_url( apply_filters( 'generate_retina_logo', generate_get_option( 'retina_logo' ) ) );
2055--> if ( $logo_url ) {
$attr = apply_filters(
becomes:
$logo_url = wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), 'full' );
$retina_logo_url = esc_url( apply_filters( 'generate_retina_logo', generate_get_option( 'retina_logo' ) ) );
if ( $logo_url ) {
$logo_url = esc_url( apply_filters( 'generate_logo', $logo_url[0] ) );
$attr = apply_filters(
Simon
Hi there,
Strange, line 2050 checks to see if a logo exists:
if ( $settings['navigation_as_header'] && get_theme_mod( 'custom_logo' ) ) {
If get_theme_mod( 'custom_logo' ) is false, it shouldn't continue with the code inside the condition.
Do you have a logo uploaded?
I think it's a problem with images on my end.
After what you said about logos, I checked and all my images are showing as the 'default' page with folded corner image in the customiser logo section. The images show in the media picker but not in the customiser.
Newly uploaded images are showing fine with no errors.
So that's what changed, my images are faulty.
I thought it was strange cos I've never seen the error before.
Many thanks
Simon
No problem - glad it's all working now :)