Skip Navigation

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

Problem:
You are setting up a language switcher using WPML on your site under development, but the flags are not showing.
Solution:
The issue might be due to the missing "wp_icl_flags" database table. Here's how you can address this:
1. Ensure you back up your site first for safety.
2. Insert the following code at the bottom of the functions.php file in your theme's root folder:

function wpml_fix_missing_icl_tables() {
  
    if( function_exists( 'icl_sitepress_activate' ) )
  
        icl_sitepress_activate();
  
}
  
add_action( 'wp_footer', 'wpml_fix_missing_icl_tables' );

3. After adding the code, visit your site's homepage at least once.
4. Remove the code afterward.
If the problem persists, we may need to install the wp phpMyAdmin plugin on your site to add the missing database table.

Please note that this solution might be 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 continues, please open a new support ticket.

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 12 replies, has 2 voices.

Last updated by mohamedM-67 11 months, 2 weeks ago.

Assisted by: Noman.

Author Posts
June 24, 2024 at 1:12 pm

mohamedM-67

Background of the issue:
I am working on a site under development and trying to set up the language switcher using WPML.

Symptoms:
Flags are not showing on the language switcher.

Questions:
Why are the flags not showing on the language switcher?

June 24, 2024 at 2:13 pm
June 24, 2024 at 2:17 pm #15808112

mohamedM-67

My website broke why

June 24, 2024 at 3:04 pm #15808562

Noman
WPML Supporter since 06/2016

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

I'm sorry to hear that your site is experiencing issues. Deactivating all plugins can sometimes cause a site to break, especially if certain plugins are essential for its functionality.

Please reactivate all the plugins and the theme that you deactivated. If the issue persists, please restore the backup you took before making changes.

Thank you

June 24, 2024 at 3:07 pm
June 24, 2024 at 3:09 pm #15808703

Noman
WPML Supporter since 06/2016

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

I have set up a fresh WP site on cloudways. Can you please migrate your site to the cloudways server so that we can see if it's a server-specific issue? I have shared the migration details in a previous private reply.

Thank you for your cooperation

June 24, 2024 at 4:53 pm #15809624

mohamedM-67

I have resotore my backup but issue still here

June 24, 2024 at 4:58 pm #15809650

mohamedM-67

What is this

June 24, 2024 at 4:59 pm #15809652

mohamedM-67

Resolve one issue and found another issue what happened to my site

June 25, 2024 at 7:47 am #15817580

Noman
WPML Supporter since 06/2016

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

I'm sorry to hear that you're still having issues. I understand how stressful this situation can be, but I'm here to help you through it. We'll get your site back up and running as quickly as possible. Let's get this sorted out step-by-step:

1. Did the backup restore completely? Sometimes, problems can persist if the backup wasn't fully restored.

2. Can you tell me exactly what problems you're seeing now other than missing flag images? Details will help me find the cause of this issue.

3. Additionally, please let me know once the migration process is completed so that we can debug the missing flag images issue further on the test server.

Thank you for your cooperation and patience

June 25, 2024 at 8:47 am #15818279

mohamedM-67

I have get this message from hosting support

June 25, 2024 at 8:47 am #15818282

mohamedM-67

[24-Jun-2024 23:04:26 UTC] E_DEPRECATED: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /home/customer/www/daycharteribiza.teatimeagency.com/public_html/wp-content/themes/houzez/framework/Mobile_Detect.php on line 1257

[24-Jun-2024 23:04:27 UTC] WordPress database error Table 'dbfpbmciclenu4.wp_icl_flags' doesn't exist for query SELECT flag, from_template
FROM wp_icl_flags
WHERE lang_code='en' made by include('hidden link'), include('hidden link'), WP_CLI\bootstrap, WP_CLI\Bootstrap\LaunchRunner->process, WP_CLI\Runner->start, WP_CLI\Runner->load_wordpress, require('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, WPML\LIB\WP\Hooks::WPML\LIB\WP\{closure}, WPML\FP\Promise->resolve, WPML\FP\Right->chain, WPML\FP\Right->map, WPML\BlockEditor\Loader->registerBlocks, WPML\BlockEditor\Blocks\LanguageSwitcher->register, WPML\BlockEditor\Blocks\LanguageSwitcher->getLanguageSwitcherLocalisedData, WPML\Element\API\Languages::__callStatic, call_user_func_array, WPML\Element\API\Languages::WPML\FP\{closure}, call_user_func_array, WPML\Element\API\Languages::WPML\Element\API\{closure}, WPML\FP\Fns::__callStatic, call_user_func_array, WPML\FP\Fns::WPML\FP\{closure}, call_user_func_array, WPML\FP\Fns::WPML\FP\{closure}, array_map, WPML\Element\API\Languages::WPML\Element\API\{closure}, WPML\Element\API\Languages::__callStatic, call_user_func_array, WPML\Element\API\Languages::WPML\FP\{closure}, call_user_func_array, WPML\Element\API\Languages::WPML\Element\API\{closure}, SitePress->get_flag, WPML_Flags->get_flag
[24-Jun-2024 23:04:27 UTC] WordPress database error Table 'dbfpbmciclenu4.wp_icl_flags' doesn't exist for query SELECT flag, from_template
FROM wp_icl_flags

June 25, 2024 at 8:50 am #15818302

mohamedM-67

Hello Tamara,

I have reviewed the situation and I am not able to find what exactly you have done here as I believe you cloned an application maybe and it is not loading correctly.

However, that issue might be due to the clone not being successful as you have exceeded the disk space of your plan currently as the size of the website teatimeagency.com is 51545MB which only that website is more than the available disk space of your plan.
32G daycharteribiza.teatimeagency.com
3.2G dreamboats.teatimeagency.com
10G teatimeagency.com

There are 22GB of the website daycharteribiza.teatimeagency.com of Updraft backups:
u6-gzrdaeqr7kxx@gmadm1015.siteground.biz:~/www/daycharteribiza.teatimeagency.com/public_html/wp-content$ du -sh updraft
22G updraft

June 25, 2024 at 9:45 am #15818722

Noman
WPML Supporter since 06/2016

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for sharing the error details it’s really helpful to understand the cause of this issue.

It seems the “wp_icl_flags” database table is missing somehow that’s why you are seeing these errors and facing missing flag images issue.

To fix this issue, can you please follow the below the below steps:

1. Please take a backup of your site first for safety reasons.

2. Add this code to the bottom of the functions.php file in your theme’s root folder.

function wpml_fix_missing_icl_tables() {
 
    if( function_exists( 'icl_sitepress_activate' ) )
 
        icl_sitepress_activate();
 
}
 
add_action( 'wp_footer', 'wpml_fix_missing_icl_tables' );

3. Visit your site’s homepage at least one time.

4. Remove the code.

And see if this resolves the issue.

If the issue persists, I’d need your permissions to install the wp phpMyAdmin plugin on your site and add the missing database table.

Please let me know the results,
Looking forward,
Thank you

June 25, 2024 at 12:40 pm #15820727

mohamedM-67

Thanks issue resolved