Skip to content

Instantly share code, notes, and snippets.

@soberanes
Created November 2, 2016 00:54
Show Gist options
  • Select an option

  • Save soberanes/7d88f4f8d99695c9f23aad88f035927d to your computer and use it in GitHub Desktop.

Select an option

Save soberanes/7d88f4f8d99695c9f23aad88f035927d to your computer and use it in GitHub Desktop.

Revisions

  1. soberanes created this gist Nov 2, 2016.
    15 changes: 15 additions & 0 deletions wp_remove_assets_plugin.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    <?php
    /**
    * Adding this script to functions.php
    */
    add_filter( 'wp', 'disable_plugin_assets' );
    function disable_plugin_assets(){
    if(strpos($_SERVER['REQUEST_URI'], '/page-slug/') === FALSE) {

    //Disable facturacom plugin's assets
    //Javascript
    wp_dequeue_script('some_script');
    //CSS
    wp_dequeue_style('some_stylesheet');
    }
    }