Efforts have been made to make sure that “Asset CleanUp Pro” is fully compatible with “WPML – The WordPress Multilingual Plugin”, and users who access the “CSS & JS manager” as well as the “Plugins Manager” will have the best experience without the need to do any repetitive tasks or get any errors due to the fact that some pages are translated into multiple languages. Moreover, whenever AJAX calls are made by WPML in the background, Asset CleanUp Pro is sometimes not loading to avoid triggering any irrelevant PHP code that might slow down the calls or even generate errors to prevent the WPML plugin from working in any way.
Asset CleanUp Pro has been developed to locate any translation pages associated with a certain page and make sure that change is applied to any other translated page. For instance, you decide that the assets (CSS/JS) from “Contact Form 7” are not needed on the homepage and you unload them by using the CSS/JS manager. If you have the homepage translated in more languages (e.g. www.yoursite.com/fr/, www.yoursite.com/es/, etc.), once you make a change (e.g. unload a CSS file) to the English version of the page, it will also update for any other translated page and vice-versa (if you edit the Spanish version of a page and you perform an update, the English, French and any other pages will have the same change applied).
These changes are coming after lots of requests from users that knew they never need the unloaded assets on any of the translated page and were frustrated to go through each translated version of the page and apply the same change.
Here are the type of pages were the changes are mirrored on any translated page:
→ Homepage (this also includes any plugins that are unloaded on the homepage from “Plugins Manager“)
Note that there are two types of homepages that can be set in “Settings” — “Reading” (from the WordPress Dashboard) which are: “Your latest posts” and “A static page”. If its the latter, then the sync will be done between the translated posts for the post chosen as the homepage, and it falls in the next category.
In “Plugins Manager” (Pro version) there’s an option to unload plugins on the homepage. This matches all translated homepages. If, for any reason, you want the rule to apply on just www.yoursite.com/ but NOT on www.yoursite.com/es/ or www.yoursite.com/de/ then you can apply the following code to the wp-config.php file (root of your WordPress installation), BEFORE the line where “wp-settings.php” is required:
define('WPACU_NO_HOMEPAGE_CHECK_FOR_PLUGIN_RULES_WPML', true); /** Sets up WordPress vars and included files. */ require_once(ABSPATH . 'wp-settings.php');
→ Any public “post” type page including: articles, pages such as “Contact Us”, WooCommerce “product” pages, etc.
Some people have reasons to prevent the syncing the changes between posts. For instance, in rare cases, one might want to unload a CSS file for the post in Spanish, but might want to keep that CSS file to load in the same post translated to French. The auto-syncing can be stopped by adding the following code snippet in functions.php (from you theme or Child theme):
→ Any public taxonomy pages including: categories, tags, WooCommerce “category” pages, etc.
Just like the posts, the syncing is automatically applied on categories. For instance, you have a WooCommerce category page listing products. If you make a change in the English version of the page, it will be automatically applied to all its versions: Spanish, French, German, etc. If you want to prevent this for any reason (e.g. you might want to unload a CSS file for the German version, but you do not want to have it unloaded for all the other languages, basically stopping the auto-syncing), you can do so by applying the following snippet in functions.php (inside the theme or Child theme):