Documentation

General / JavaScript – JS Variables Replace

Posted in: Getting Started (4) How To (15) Plugin Options Explained (37) Actions / Filters (31)      Options (28)    Html Content (5)    Replace (10)  

This functionality is available for PRO version.

 

This module is deprecated and replaced by Html/Css/JS Replacements

 

Through this module, commonly used JavaScript variables/functions from WordPress, plugins and theme can be renamed to something else. Often hackers boots parse and render the html in attempt to find specific variables which are widely used on WordPress ecosystem.
The following can be found in majority of websites:

  • wpcf7 – is being used by the Contact Form 7
  • qxshop_params, wc_cart_fragments_params – belong to WooCommerce platform
  • twentyseventeenScreenReaderText – Twenty Seventeen WordPress theme

This is a complex functionality which concatenate all page JavaScript code into 2 assets for post-processing. It also use a cache system with static files to prevent additional processing. This feature also helps a lot on increasing page speed, meaning also overall SEO, mainly for sites with lots of JavaScript files to load, as instead loading a bunch of resource data, it process just 2 files.

The JavaScript Combine Code option gather all JS resources from page, either inline or local files and combine into a single asset file.

Specific scripts can be excluded from the above procedure and leaved as is.

Through JavaScript Variables Replace area, actual JavaScript replacements can be done. In this particular example the wc_add_to_cart_params variable will be changed to add_cart_args, also the qxshop_params will be changed to ecom_params. The code will know what and where to change for the JavaScript to continue to run as normal.

Generally this module require very basic knowledge, to the point of making a difference of JavaScript variables. A simple page source or asset visualization will be enough to identify common variables which user may want to change through this interface.

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
Scroll to top