amnestywebsite / humanity-theme

The Amnesty International WordPress Humanity Theme
https://wordpresstheme.amnesty.org/
Other
38 stars 10 forks source link

Bug - Footer - PHP Warnings appear in footer #477

Open valentin-dassonville opened 1 week ago

valentin-dassonville commented 1 week ago

Describe the bug
I install the theme in an empty wordpress with wp cli and some warnings appear in the footer (see screenshots). I've also installed all the required plugins.

To Reproduce
Steps to reproduce the behavior:

  1. Install wordpress with wp cli (wp core download, config and install)
  2. Install the theme and activate it : wp theme install https://github.com/amnestywebsite/humanity-theme/releases/download/v2.0.8/humanity-theme.zip --activate
  3. Install required plugins : (cmb2, cmb2-attached-posts, cmb2-password-field, ...)
  4. Start wordpress with wp server
  5. Go to http://localhost:8080
  6. Some warnings appear in the footer

Expected behaviour
No warnings

Actual behaviour
Warnings appear in footer

Screenshots

Capture d’écran 2024-11-12 à 14 10 46

Platform:
I actually work on localhost

Additional context
The warnings seems to be related to the $menu variable in the function amnesty_get_nav_menu_items in navigation.php. The value of the variable can be false because this is not checked beforehand.

I suggest : $menu_items = $menu ? wp_get_nav_menu_items( $menu->term_id, [ 'update_post_term_cache' => false ] ) : []; at the line 147 in navigation.php to check the value of $menu.