Open
Overview of the issue
When using the Astra theme with WPML, PHP warnings related to undefined properties (menu_id) are displayed in the WPML > Languages section. These warnings appear when a main menu is assigned, and WPML’s „Menu Language Switcher“ is enabled.
Warning: Undefined property: stdClass::$menu_id in .../wp-content/themes/astra/inc/extras.php on line 513 Warning: Undefined property: stdClass::$menu_id in .../wp-content/themes/astra/inc/extras.php on line 546
Workaround
Please, make sure of having a full site backup of your site before proceeding.
- Open …/wp-content/themes/astra/inc/extras.php file.
- Look for line 513.
- Replace:
if ( in_array( $args->menu_id, $astra_menu_locations ) ) {
- With:
if ( isset( $args->menu_id ) && in_array( $args->menu_id, $astra_menu_locations ) ) {
- In the same file, move to line 546.
- Replace:
$is_special_menu = in_array( $args->menu_id, $special_menu_ids );
- With:
if ( isset( $args->menu_id ) && in_array( $args->menu_id, $astra_menu_locations ) ) {