Articles

Article updates

wp-hide/module/general_css_variables_replace/placeholder_ignore_css

This functionality is available for PRO version.

Name: wp-hide/module/general_css_variables_replace/placeholder_ignore_css
Type: Filter
Arguments: (bool) $ignore, (text) $element_content, (string) $element_href

This filter can be used to leave specific in-line Cascading Style Sheet code or stylesheet asset within HTML source. When using  CSS Concatenate, all in-line Cascading Style Sheet code are being combined along all local css assets into a single file.
Continue reading

wp-hide/module/general_js_variables_replace/placeholder_ignore_inline_js

This functionality is available for PRO version.

Name: wp-hide/module/general_js_variables_replace/placeholder_ignore_inline_js
Type: Filter
Arguments: (bool) $ignore, (text) $element_content

This filter can be used to leave specific in-line JavaScript code within HTML source. When using  JavaScript Concatenate, all in-line JS code are being combined along with all local JS assets into a single file.
Continue reading

General / CSS – Class/ ID replacement

This functionality is available for PRO version.

 

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

 

The module implement a post-processing engine, to provide additional functionality for Cascading Style Sheet data type. The  visual interface is self explanatory and the options are easy to understand for non technical persons.

A requirement for post-processing availability, is the CSS Combine feature, which parse all local Cascading Style Sheet assets and in-line styling, process and save as an unique file, to be used within the outputted HTML. This clean’s up the source code which slightly increase the page loading speed, due to lower number of resources to be loaded through multiple calls. The generated file is being cached internally for fast forwarding on another call.

This option also works great with any cache plugins to provide a robust page load, as the code continue to forward the cached data, instead re-process it.

 

Changing specific ID’s for HTML and CSS data can be achieved though CSS ID Replace option. This is very useful to replace specific WordPress ID’s like wpadminbar. The replacement occur at the HTML level. The processing also continue within Cascading Style Sheet data to ensure layout consistency preservation, so the output will still appear correctly.

The Class Replace options works similar to ID Replace. The classes substitution apply for HTML source code on all instances, also for Cascading Style Sheet data. The layout appearance will be conserved as there new classes continue relationship with declared styling properties.

Global replacement for a specific class is available. For example, using Elementor builder plugin, outputs lots of elementor classes and variants like elementor-page, elementor-inner, elementor-section-wrap, elementor-element, elementor-section-boxed etc. No need to specify each of variant, a global can be used instead. This consist on add an asterix to searched class.

General / JavaScript – JS Variables Replace

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.

Rewrite – Map URLs

This functionality is available for PRO version.

The Map URLs module can be used to change individual URLs to custom ones. The interface consists of 2 fields, an Url to replace and an Url replacement.

Any site URL’s can be mapped to something else. Any type of asset works with re-mapping e.g JavaScript, Cascading Style Sheets, Media Images etc. An url should always start with a slash.


/wp-content/plugins/qxshop/assets/js/frontend/qxshop.min.js

to


/ecommerce.min.js

Directories can also be re-mapped, they need to end in a forward slash


/wp-content/cache/

to


/static-data/

The plugin cache directory can be easily changed to something else using something like this


/wp-content/cache/wph/

to


/app-data/

On WordPress MultiSite environment, if using multiple domains and specific URLs need to be changed per domain base; the –domain-name– should be replaced with actual one:


//--domain-name--/wp-content/plugins/woocommerce/assets/js/frontend/cart.js

to


//--domain-name--/shopp.js

There are a few requirements for a replacement and replace Url for the module to process:

  • The resource must be on the same domain as the website or if run on MultiSite, the resources must match one of the existing domains.
  • The URLs can start or not with a domain. If starts with a domain, a double slash should be prepended per above example.
  • If the asset has already been rewritten by another module but still needs further modification, the default URL format must be used. This format can be observed in the outputted HTML when no rewrite has been applied.
  • If there are multiple instances of the same URL (e.g. image asset) all will be replaced with the new provided Url.
  • Any incomplete or invalid URL, either the replaced or replacement makes the entry obsolete and will be ignored.

Preserve specific text / html block within outputted code

This functionality is available for PRO version.

The WordPress WP Hide & Security Enhancer PRO achieve provided functionality through internal filters and rewrite code. This ensure a perfect compatibility is maintained across the site without requiring to change anything at the code level or to any of WordPress files/folders structure. Any updating functionality for wither WordPress plugins/themes or custom code is preserved and it will run the same as before.

Generally, the plugin do the replacements at the end of WordPress core code execution, it will replace any occurrence of specific urls and paths with new ones which are being translated through rewrite code. In some situations, specific links, texts and html blocks are required to stay as is. To achieve that, there’s an easy approach, the specified blocks need to be wrapped up in a specific HTML comment tags:

<!– WPH Preserve – Start –>
block to preserve
<!– WPH Preserve – Stop –>

The following example preserve the content as is for a textarea field. Any matching urls and texts which will match the textarea content will not be replaced.


<!-- WPH Preserve - Start --> 

<p><textarea id="export_settings" class="code" readonly="readonly" rows="12">This is a preserved URL https://wp-hide.com/skin-nsp/images/logo.png</textarea></p>

<!-- WPH Preserve - Stop -->
Scroll to top