Description
This hook is called before any MediaPress javascript file is registered for loading. It can be used to selectively disable loading of JavaScript files from MediaPress.
Parameters
The only parameter passed is a boolean. The value controls whether to load js files or not.
Returns
true if loading is allowed, false to prevent loading.
Usage
1 | <?php add_filter( 'mpp_load_js', 'function_name' ); ?> |
where “function_name” is the name of function to be called.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | add_filter( 'mpp_load_js', 'mpp_custom_control_js_loading' ); /** * Whether to load js or not? * * This example function disables loading of js on site home page * * @param boolean $do_load * @return boolean */ function mpp_custom_control_js_loading( $do_load ) { if( is_home() ) { $do_load = false; } return $do_load; } |
Source
mediapress/assets/script-loader.php