Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Dequeue Select2 Add-on
<?php
/*
Plugin Name: TACBPW dequeue Select2 Add-on
Plugin URI: http://tiptoppress.com/downloads/term-and-category-based-posts-widget/
Description: Add-on to dequeue Select2 script and styles for the Term and Category based Posts Widget.
Author: TipTopPress
Version: 1.0
Author URI: http://tiptoppress.com
Installation:
A.) Manual / with a FTP client
- Download the file and rename it to Sort-by-menu-order-add-on.php
- Upload it to the plugins folder [your-wordpress-installation]/wp-content/plugins/sort-by-menu-order-add-on.php
B.) With Plugins admin
- Downlaod the file as ZIP
- Go to Plugins > Install > Upload and select the ZIP file
... than:
- Go to WordPress > Admin > PlugIns and activate the Extension
*/
namespace termCategoryPostsPro\DequeueSelect2Addon;
// Don't call the file directly
if ( !defined( 'ABSPATH' ) ) exit;
/**
* Dequeue Select2 script and styles
*
* @return array void
*
* @since 1.0
*/
function dequeue_admin_scripts ( $hook) {
// select2.
if ( 'widgets.php' === $hook || 'post.php' == $hook ) { // enqueue only for widget admin and customizer. (add if post.php: fix make widget SiteOrigin Page Builder plugin, GH issue #181)
if ( version_compare( $GLOBALS['wp_version'], '4.4', '>=' ) || ! isset( $GLOBALS['wp_customize'] ) ) {
wp_dequeue_script( 'select2-jss' );
wp_dequeue_style( 'select2-css' );
}
}
}
add_action( 'admin_enqueue_scripts', __NAMESPACE__ . '\dequeue_admin_scripts', 40 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.