WPML provides a set of constants you can use in your theme or plugin’s PHP files and templates.
Besides constants defined by the WPML core plugin, you can use constants available for our add-on plugins.
WPML Multilingual CMS Constants
ICL_DISABLE_CACHE
Use this constant to disable WPML object caching. The default value is false.
ICL_DONT_LOAD_LANGUAGES_JS
Setting this constant to true removes the language switcher JavaScript file (e.g.
\sitepress-multilingual-cms\templates\language-switchers\legacy-dropdown\script.js).
ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS
Setting this constant to true removes the language switcher CSS (e.g.
\sitepress-multilingual-cms\templates\language-switchers\legacy-dropdown\style.css)
WPML_TRANSLATION_AUTO_UPDATE_ENABLED
For page builders, WPML provides a feature for automatically updating content.
To disable this feature set the value of this constant to false.
WPML_TAXONOMY_TRANSLATION_MAX_TERMS_RESULTS_SET
Use this constant to set the number of terms to display on the WPML → Taxonomy translation page.
The default value is 1000.
WPML_SAVE_XLIFF_PATH
Use this constant to define the server path for saving XLIFF files when downloading jobs from the WPML → Translations page. For example:
define('WPML_SAVE_XLIFF_PATH', '/home/test-user/Desktop');
After downloading a translation job, a copy of the file will be created in the defined folder.
WPML_DO_NOT_RESIZE_UPLOADED_FLAGS
By default, WPML’s language switcher flags are automatically resized to 18×12 pixels for consistency.
Sometimes, you might not want to resize your flags. Fox example, they might be handled by a custom CSS or JavaScript or you want to display a custom animated GIF. In such cases, you can turn off automatic resizing by setting this constant’s value to true.
For more information check our page about customizing the language switcher flags.
WPML_INSTALLER_LOGGING
Setting this constant to true enables logging of everything related to the WPML installer. This will create a log file called installer.log in your site’s ..\wp-content\plugins\sitepress-multilingual-cms\vendor\otgs\installer\ folder.
This constant is intended to be used by developers only. For generic installer logs please go to WPML → Support and then the Installer Support page in your site’s admin.
OTGS_DISABLE_AUTO_UPDATES
If you set this constant’s value to true, WPML and Toolset will stop automatically checking for updates. You will need to check for updates manually.
WPML_EXPORT_ALL_TO_XLIFF_LIMIT
You can use this constant to set the maximum amount of jobs that can be exported to XLIFF from the WPML → Translations page.
The default value is 1700. This is the number of jobs that all servers should be able to process in a reasonable time. If your site runs on a fast server, you can increase this limit if needed.
WPML String Translation Constants
WPML_ST_SYNC_TRANSLATION_FILES
Setting this constant to true syncs WPML translation files (MO files) between multiple servers.
For more information check our page about syncing translation files for sites running on multiple servers.
WPML_ST_MO_SCANNING_LIMIT
WPML String Translation scans and imports MO files to make them available for translation. You can use this constant to define the number of MO files that can be imported in one request.
The default value is 20000.
WPML CMS Nav Constants
WPML_CMS_NAV_DISABLE_CACHE
Setting this constant to true disables WPML CMS Navigation caching.
For more information check our page about the WPML CMS Navigation plugin.
ICL_DONT_LOAD_NAVIGATION_CSS
Setting this constant to true disables the loading of cms-navigation-base.css and cms-navigation.css files.
WooCommerce Multilingual Constants
WCML_GEOLOCATED_COUNTRY
Use this constant to force WooCommerce Multilingual to use a specific country when querying a geolocated country.
The constant value should include a two-digit country code (e.g. GH for Ghana).
define( 'WCML_GEOLOCATED_COUNTRY', 'GH' );
This constant can be useful for testing. For custom modules, please use the dedicated API hook.
Advanced Custom Fields Multilingual Constants
To see which constants you can use in ACFML, check out our guide to ACF Multilingual Hooks and Constants.