Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
If you're experiencing a warning message about an undefined property in the Astra theme's extras.php file while configuring WPML, specifically related to stdClass::$menu_id on lines 508 and 546.
Solution:
We recommend checking if the menu_id property exists in the $args object using isset() to avoid the error when the property is undefined. You can temporarily update the following lines in the /wp-content/themes/astra/inc/extras.php file:

if (isset($args->menu_id) && in_array($args->menu_id, $astra_menu_locations)) {

on line 513
and

$is_special_menu = isset($args->menu_id) && in_array($args->menu_id, $special_menu_ids);

on line 536.

This solution might be irrelevant if it's outdated or not applicable to your case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the issue persists, please open a new support ticket at WPML support forum.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: ,

This topic contains 26 replies, has 3 voices.

Last updated by Marcel 1 month, 1 week ago.

Assisted by: Marcel.

Author Posts
September 19, 2024 at 3:27 pm #16199647

samM-20

<b>Background of the issue: </b>
I am trying to configure the default flag format in WPML on my site hidden link. I see a warning message between 'Default flag format' and 'Language switcher options'. The warning message is related to an undefined property in the Astra theme's extras.php file.

<b>Symptoms: </b>
Warning: Undefined property: stdClass::$menu_id in /home/httpd/vhosts/***.com/***.com/wp-content/themes/astra/inc/extras.php on line 508 and line 546

<b>Questions: </b>
How can I resolve the undefined property warning in the Astra theme when configuring WPML?

September 20, 2024 at 6:18 am #16201272

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

Thanks for contacting us.

While you wait for my colleague to take over the ticket, let me try to help you with the issue quickly.

It could be that it only appears on that page but actually still happens, can you check other backend random pages/settings and see if the message still happens?

If not, are there any specific steps or settings needed for this error to appear? That way we can check from our side.

Thanks,
Drazen

September 21, 2024 at 9:40 am #16204624

samM-20

I can't see any changes and don't find any settings that would change the error message.

September 23, 2024 at 9:27 am #16208252

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

thanks he info. I would like to check your settings. Therefore, I would like to request temporary access (wp-admin and FTP) to your site so I can take a better look at the issue. It would be better to a testing site where the issue is replicated.

You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Maybe I'll need to replicate your site locally. For this, I’ll need to temporarily install a plugin called “Duplicator” or "All in One WP Migration" on your site. This will allow me to create a copy of your site and your content. Once the problem is resolved I will delete the local site. Let me know if this is ok with you.

IMPORTANT
-Please make a backup of site files and database before providing us access.
-If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this:
hidden link

Best Regards,
Marcel

September 26, 2024 at 6:50 am #16223209

samM-20

We did not yet have time to prepare the access info and send it over to you. Please keep the ticket open – we'll do so as soon as possible.

September 26, 2024 at 5:09 pm #16226889

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Sure, thanks for the information! If it's more convenient for you, feel free to provide a site copy using the Duplicator plugin.

Best regards,
Marcel

October 1, 2024 at 9:04 am #16239148

samM-20

I guess we already tried the Duplicator way to solve the issue. Could you please again activate a private box so I can provide access details to you?

October 1, 2024 at 9:07 am #16239152

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better to a testing site where the issue is replicated.

You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Maybe I'll need to replicate your site locally. For this, I’ll need to temporarily install a plugin called “Duplicator” or "All in One WP Migration" on your site. This will allow me to create a copy of your site and your content. Once the problem is resolved I will delete the local site. Let me know if this is ok with you.

IMPORTANT
-Please make a backup of site files and database before providing us access.
-If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this:
hidden link

Best Regards,
Marcel

October 1, 2024 at 9:32 am #16239208

samM-20

Both sites (***.com and ***.ch) seem to be terribly slow since we installed WPML. We have a third one at the same hosting provider with the same hosting contract that's running without WMPL and is way faster loading (outlinecontrol.com). Could that be a side effect of a misconfiguration as well?

October 1, 2024 at 9:36 am #16239220

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

It appears your site is running slowly due to insufficient memory allocation. According to the system requirements outlined here (https://wpml.org/home/minimum-requirements/), you have 640MB of PHP memory available, but WordPress is currently limited to using only 40MB.

Please review this and, if needed, open a separate support ticket with more details about the performance issues you're experiencing.

I will update you here once I’ve had the opportunity to review your site further.

Best regards,
Marcel

October 1, 2024 at 11:51 am #16240185

samM-20

Fine, thanks for the memory related hints, we'll work on that issue with our hoster.

Right now the site seems to be broken, it only shows this error message in the frontend:

Warning: include(/de): Failed to open stream: No such file or directory in /home/httpd/vhosts/***.com/***.com/wp-content/plugins/sitepress-multilingual-cms/classes/request-handling/redirection/wpml-rootpage-redirect-by-subdir.class.php on line 45 Warning: include(/de): Failed to open stream: No such file or directory in /home/httpd/vhosts/***.com/***.com/wp-content/plugins/sitepress-multilingual-cms/classes/request-handling/redirection/wpml-rootpage-redirect-by-subdir.class.php on line 45 Warning: include(): Failed opening '/de' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /home/httpd/vhosts/***.com/***.com/wp-content/plugins/sitepress-multilingual-cms/classes/request-handling/redirection/wpml-rootpage-redirect-by-subdir.class.php on line 45

I guess that's a side effect of your trouble shooting, right?

October 2, 2024 at 7:13 am #16243485

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

You can adjust the memory limit yourself in the wp-config.php file; there’s no need to rely on your hosting provider for this. 🙂

Also, the issue you're experiencing isn't related to any troubleshooting steps, as I haven't accessed the site yet. Please navigate to WPML > Languages. It looks like you're not using a root page, which is required when setting "languages in folders." You can find more details here: WPML Documentation.

Best regards,
Marcel

October 2, 2024 at 3:21 pm #16246531

samM-20

Thanks for your assistance.

So I really need to go all the way through the struggle with setting up a page with a separate template to make it redirect to the default language home page, like /de ?

(Would be nice to have the possibility to select an existing page.)

October 2, 2024 at 3:27 pm #16246551

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

You can set up a redirect to /de directly using PHP, but this approach won't allow you to select a specific WordPress page. To achieve this, you'll need to include an HTML file that loads the PHP code. For more details, you can refer to this guide: Redirecting the root domain to the default language directory.

<?php
/*
Template Name: Root redirect
*/
wp_redirect( home_url() );
exit;
?>

The Home-URL is already pointed to /de - defined in your WP settings.

Best regards,
Marcel

October 2, 2024 at 3:57 pm #16246653

samM-20

I don't really know where to put the php template. In what directory should it be?

(I actually would prefer not to mess around in the theme's directory, since that could mean I need to re-do those steps when updating the theme, I guess.)

And there's no «template» setting in the root page side bar. Where do I find it?

(I actually licensed Astra Pro and WPML to avoid coding and file editing, because I am no programmer. Now I seem to end up in that coding corner anyway. Sniff.)