Salta la navigazione

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

Lasciare una risposta

Ti preghiamo di rimanere in tema e di essere rispettoso nei confronti degli altri. Se hai bisogno di aiuto per questioni non correlate a questo post, utilizza il nostro Forum di supporto per avviare una chat o inviare un ticket.

Potete usare questi tag:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>