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.

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

Problem: Custom flag not uploading to database Solution: We reset language table on Languages -> Edit Languages -> Reset languages

This topic contains 15 replies, has 2 voices.

Last updated by paulD-2 3 months, 1 week ago.

Assigned support staff: Bruno Kos.

Author Posts
July 3, 2019 at 9:37 am #4134079

paulD-2

We are unable to load a custom flag to accompany a new language.

I have turned plugins off and on. Ensured fileinfo is enabled. Turned on error reporting ... and I think I have located the issue but would appreciate your help in resolving it.

The WP_DEBUG code from WordPress reports: "Notice: Trying to get property of non-object in .../htdocs/sitename.com/wp-content/plugins/sitepress-multilingual-cms/menu/edit-languages.php on line 401".

A quick look at the database in wp_icl_languages tells me that the language has been added. But wp_icl_flags does not show any record of the flag. So, I guess this suggests the flag reference isn't being uploaded to the database. If I were to add the flag details in to the database it would work, but it won't resolve the underlying issue. Any suggestions..?

One other question, while I'm here. Is there an update on the SEO site-indexing issue when using browser language redirect..?

July 3, 2019 at 10:23 am #4134659

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

Thank you for contacting WPML support!

Based on debug information you provided, can I ask you update WPML and all the other WPML add-ons to latest versions?
https://wpml.org/account/downloads/

Also, could you make sure your server conforms to our minimum requirements?
https://wpml.org/home/minimum-requirements/

Based on provided debug information, I can see the following - WP Memory Limit: 40M.

Specifically, could you set WP Memory limit to at least 256MB?
https://wordpress.org/support/article/editing-wp-config-php/#increasing-memory-allocated-to-php

If unsure on how to set this, you can consult your host/server admin to do this. After you increase this value, you can confirm it by checking on WPML -> Support by finding the “Memory limit” value.

As for the issue itself, this is not something we are able to reproduce on a clean installation and there were only few reported cases so far. It seems like that it was mostly related some server settings, while in some cases due to incomplete database table structure:
https://wpml.org/forums/topic/unable-to-upload-custom-flag-fatal-error/#post-3728995
https://wpml.org/forums/topic/change-flag/#post-3484319
https://wpml.org/forums/topic/i-just-installed-wpml-but-i-get-a-few-php-errors-and-flags-are-not-shown/#post-1192658

Therefore, I'm quite certain that this issue is setup-specific and may be very difficult and time consuming to reproduce and debug properly, so if you are able to get it working with adding the flag directly into database, I suggest you go for it.

As for your other question:

Is there an update on the SEO site-indexing issue when using browser language redirect..?

This is the only information I can provide - I'm not aware that there have been any changes here:
https://wpml.org/documentation/getting-started-guide/language-setup/automatic-redirect-based-on-browser-language/how-browser-language-redirect-affects-google-indexing/

Regards,
Bruno Kos

July 3, 2019 at 11:59 am #4135985

paulD-2

Thanks Bruno.

Could you send me an example of the SQL command that I would use to add a flag to the database..?

July 3, 2019 at 12:40 pm #4136431

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

I guess that something like this might work, but honestly I have never tried this before, So I'm not sure if this is the proper way in fact:

INSERT INTO `wp_icl_flags` (`id`, `lang_code`, `flag`, `from_template`) VALUES (NULL, 'new-nw', 'new-nw.pmg', '1');

However, by doing it this way it would end up in wp-content/plugins/sitepress-multilingual-cms/res/flags/ and not in /uploads folder, so it may disappear on the next update.

Can you tell me what exactly happens when you try saving the flag - does it stay like nothing has been uploaded, or is the issue that image did not upload (404 error on the image url)?

It would help if you could either provide me with WordPress credentials and images. I have marked your next reply as private so you can safely add WordPress credentials.

https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

Please make a full backup of your site before sharing this info!

You can use plugins such as UpdraftPlus WordPress Backup Plugin (https://wordpress.org/plugins/updraftplus/) or ask your host to perform a site backup.

Regards,
Bruno Kos

July 9, 2019 at 12:52 pm #4170907

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

In order to debug this issue , can you install Duplicator plugin and create package so that I can try this on my localhost and possibly escalate further to 2nd tier?

There are some things I would like to try, but not on your production site (unless you can make a site backup and allow me to try?).

I would like to:
- see if the issue is happening on my localhost
- see if there's something rendering in debug.log
- check if any of the WPML troubleshooting options working in this case, especially resetting the languages table

https://wpml.org/faq/provide-supporters-copy-site/

Let me know if this is OK with you.

If I test this on your production site, I would also need FTP access for which I have marked your next reply as private.

Regards,
Bruno Kos

July 9, 2019 at 1:24 pm #4171201

paulD-2

Hi Bruno,

Have uploaded Duplicator and I am waiting for the package to build. I'm also setting up an FTP account.

Thanks for your patience.

July 9, 2019 at 2:08 pm #4171659

paulD-2

Hi Bruno,

Finally finished building the package (which you will see in the Duplicator section) but there was a message for a 'Host Build Interrupt'. Shall I try building another package..?

July 9, 2019 at 2:13 pm #4171719

paulD-2

Hi Bruno,

I have set up access to FTP. Could you send me a Private Message so I can pass on the details..?

Many Thanks

July 9, 2019 at 2:18 pm #4171747

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

I'm currently downloading packages, which will take a while because they are over 800MB. I will let you know as soon as I deploy it on my localhost and see if I can get any useful information from that.

Regards,
Bruno Kos

July 9, 2019 at 2:31 pm #4171873

paulD-2

Thanks Bruno,

A quick question: If we were to 'Use directory for default language', in our case adding /au/ to the URL, will that affect our existing links from Google or links in print media etc..?

Example: If a visitor were to enter the link hidden link, which would be altered to read hidden link ... would they be automatically redirected to the page with the /au/ path..?

Many Thanks

July 9, 2019 at 3:11 pm #4172315

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

I was able to deploy the package in my localhost and the flag did not save either. I got exactly these error messages in debug.log:

https://wpml.org/forums/topic/cant-upload-custom-flag-for-new-languages/#post-1529041

According to this, there are two approaches:
- escalate to 2nd tier for further checking and database patching
- resetting language table

On my localhost installation, I did the second option and it worked. Since I created a new language which had the same language code (and other language parameters) as before, all translations seem to be intact, so this is the path I think you should take as well.

As for your additional question - that mean that you would like to use "Use directory for default language" option? I have tested this option on my localhost and even if I remove e.g. /en/ part from the URL, it redirects me to the correct one, so:
- hidden link
takes me to:
hidden link

I cannot tell you how Google will crawl these changes, but I guess that they will pick up new URLs once they crawl the website again.

Regards,
Bruno Kos

July 9, 2019 at 3:44 pm #4172739

paulD-2

Hi Bruno,

I'll make another back up of the database and will 'Reset languages', hopefully that will resolve the 'Adjust IDs for multilingual functionality' issue also.

It's just coming up for 2am here in Australia so I'll try it first thing in the morning and will let you know how I go. 🙂

Thanks ever so much for all your help.

July 10, 2019 at 5:46 am #4176227

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

Adjust IDs for multilingual functionality

I forgot about this one - what exactly isn't working here? Are you not able to save this setting or it is not working as expected? If the later, can you tell me how did you determine this?

Regards,
Bruno Kos

July 15, 2019 at 12:31 pm #4210979
paulD-2

Hi Bruno,

Once again apologies for the delay. Yes, one more thing. We do require a banner to be different between NZ and AU regions. This is achieved through the theme: Newspaper > Theme Panel > Ads > Header Ads. But it seems the two languages are using the same theme values (so changing the banner address in AU overwrites NZ and vice versa).

Hopefully it's a simple fix.

Many Thanks

New threads created by Bruno Kos and linked to this one are listed below:

https://wpml.org/forums/topic/split-custom-flag-not-uploading-to-database/

July 15, 2019 at 1:18 pm #4211403

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

If there is nothing else in this topic, can you mark this one as completed? As for the newspaper issue, I have created a new topic from this one and already replied there.

Regards,
Bruno Kos