How PostProcessing works with assets loaded outside of page HTML dataset
What PostProcessing means?
In a nutshell, The PostProcessing and Replacements functions occur right before the server send the HTML data back to the user browser. That ensures processing for everything on the page, including the assets.
How to activate the functionality?
The plugin core includes the “Document Loaded Assets PostProcessing” module which helps with that. As default, the module is disabled to avoid confusion. But can activate using the following line within the wp-config.php
define( 'WPH_DOCUMENT_LOADED_ASSETS_POSTPROCESSING', TRUE );
For easy identification of the assets loaded outside of the HTML dataset, a constant can be used to instruct the code to outputs console notices for such data. The following line goes to wp-config:
define( 'WPH_ASSETS_MUTATIONS_HINT', TRUE );
Within the console, the hints show as follow:
Once the assets are identified, to avoid unnecessarily console outputs, the hint constant should be removed from the code.
How to use the functionality?
The module core attempts to process the list, every URL item is reversed to the default format, as it was shown before the wp-hide apply:
Regex patterns can be used within the URLs. That reduces the number of rewritten lines which generally means slightly faster processing. Per the above URLs example, the .* regex quantifier pattern can used to narrow the lines to the followings:
Doing so, changing any of the plugin options does not affect this list URLs.
Further, the core creates the required rewrites to apply which loads the provided resources through a proxy processor.