Created
February 3, 2017 22:48
-
-
Save tripflex/ba94d72b375a6ca1c9d2094486e0f189 to your computer and use it in GitHub Desktop.
Death to sloppy developers (dequeue method for sloppy developers that load their javascript on every page ... ugh)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ^ do not include this, it's only for code highlighting purposes | |
// Update the method/function in wp-job-manager-field-editor/classes/admin/assets.php with the function/method below | |
function death_to_sloppy_devs( $hook ){ | |
// Return if not on plugin page, which some devs fail to check! | |
if ( empty( $hook ) || ( ! empty( $hook ) && ! in_array( $hook, $this->hooks ) ) ) return; | |
$assets = array( 'wpum-admin-js', 'jquery-ui-sortable', 'jquery-ui-draggable', 'scporderjs', 'kwayyhs-custom-js', 'mobiloud-menu-config', 'wp-seo-premium-quickedit-notification' ); | |
foreach( $assets as $asset ){ if( wp_script_is( $asset, 'enqueued' ) ) wp_dequeue_script( $asset ); } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment