Skip Navigation

Open

Topic Tags: Compatibility

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 ) ) {
    

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>