If you want to dequeue scripts & styles for a specific page based on the slug of the page. You can get the slug in various ways and use it instead of $_SERVER['REQUEST_URI']
.
Use if( is_page( array( 'my_page')
instead of if(basename($_SERVER['REQUEST_URI'])=='my_page')
function wpse_289574_dequeue_scrips() {
if(is_page( array( 'my_page')){
wp_dequeue_style( 'taxonomy-image-plugin-public' );
...
}
}
How to get the slug of a page:
$qo = $GLOBALS['wp_the_query']->get_queried_object();
$cp = sanitize_post($qo);
$slug = $cp->post_name;
Taken from: How to retrieve the slug of current page?
function wpse_289574_dequeue_scrips() {
if($slug =='my_page'){
wp_dequeue_style( 'taxonomy-image-plugin-public' );
...
}
}
Current hook to dequeue is wp_enqueue_scripts
.
Related Posts:
- How do I get the $handle for all enqueued scripts?
- How can I get a list of all enqueued scripts and styles?
- How to properly dequeue scripts and styles in child theme?
- How to load JQuery easing script in wordpress?
- How to remove some external js files from source?
- Select2 in WordPress
- wp_enqueue_script with dependencies doesn’t work
- Help with enqueing scripts in footer after init action
- How to load script-related styles automatically?
- How to cancel `wp_print_scripts`?
- How do I enqueue a JavaScript in my footer via the functions.php file?
- Retrieve URL of Script/Style and Dependencies
- Is there a way to list all the JavaScript scripts that are actually loaded by WordPress? Do we care?
- Styles and scripts inside template part
- why quotes shown in WordPress?
- Enqueuing a script before anything else
- wp_enqueue_script was called incorrectly Issue when active plugins of WordPress Admin Bar Improved
- is there a way to get all queued scripts/styles into a template without `get_header()`?
- How do I pass $in_foooter to wp_enqueue_script() without passing other params?
- How to get, in WP page’s script, a wp enqueued script (in Functions.php)?
- How do I display the handle for all front-end enqueued scripts in plugin options page?
- How do I dequeue a parent theme’s CSS file?
- Check if a script/style was enqueued/registered
- Is it possible to use wp_localize_script to create global JS variables without a specific script handle?
- Prevent Version URL Parameter (?ver=X.X.X) on Enqueued Styles & Scripts
- How can I enqueue protocol relative external (//ajax.googleapis.com/…) scripts?
- Can’t enqueue scripts in the footer?
- How can I remove the site URL from enqueued scripts and styles?
- Loading a script with a dependency, is unloading another script’s dependency
- wp enqueue script using scripts from cdn with a safety callback
- Can I add styles to footer with $wp_styles->add_data?
- Enqueue script in specific page
- How to en-queue bootstrap 4 to theme?
- Notice that the wp_enqueue_style is not being called correctly!
- Hyphens vs. periods in the script slug in wp_register_script?
- jquery script not enqueued in child theme
- Is This The Most Efficient Way To Add Javascript Files?
- wp_register_script multiple identifiers?
- Trying to load different syles for 404.php page
- Enqueue Script with URL parameters
- How to use wp_enqueue_style() and wp_enqueue_script() only when needed?
- Preload key requests using wp_enqueue
- Remove specific CSS and JS from the head
- How do I enqueue(or delay loading of) tags in individual page posts?
- Which are the MediaElement.js scripts to enqueue
- Child Theme – what is the scope of overwriting files?
- Best spot for wp_register_script() and wp_register_style()
- wp_enqueue_script adds only the first script
- Adding custom fonts (local) to WordPress?
- wp_enqueue_script order – external vs inline js
- Dequeuing scripts for all pages but the home page
- Which jQueryUI handles are predefined in wordpress?
- Modernizr check first, then move on to wp_register_script()/wp_enqueue_script
- How to avoid loading same script twice?
- Deregister scripts on unnecessary pages using remove_action
- Prioritizing wp enqueue scripts error
- wp_enqueue and Dependencies
- How do you enqueue a Visual Basic script using wp_enqueue_script?
- Why are files enqueued with wp_enqueue_style and wp_enqueue_script 404 Not Found?
- jquery-ui-autocomplete is not loaded with wp_enqueue_script
- wp_enqueue_script Doesn’t Work?
- Why won’t my scripts load?
- wp localizing script not works
- Is It Possible to add JS AFTER the Enqueue within the same Function?
- How can I manually enqueue plugin scripts
- How to enqueue JavaScript file that depends on CSS stylesheet
- How can I properly enqueue wp-hooks without issues?
- Enqueue customizer scripts that are bundled by webpack?
- wp enqueue, how to prevent duplication when same script is registered with different handles
- Localizing script to pass a value to a javascript function
- get_template_directory_uri not dependent on WP_HOME in wp-config.php?
- Dequeue script conditonnally
- Help to enqueue a js functions ( jquery) [closed]
- Conditionally load script depending on current admin page
- Enqueue script inside IE conditional comments
- How can I integrate Fancybox 3 in WordPress properly
- How to enqueue default scripts with dependency?
- Should I use get_bloginfo(‘stylesheet_directory’) or get_stylesheet_directory_uri() when enqueueing my js files?
- How to load API’s in WordPress?
- Adding Pinterest Script Before Closing Body Tag
- How Do I Enqueue a Script into 2 different Footers on the Same Site?
- how to load css and js based on post template
- link to JS library using wp_enqueue_scripts not working
- Using wp_enqueue_script on scripts that contain PHP
- Enqueue specific script on account creation (and never again)
- Proper enqueue for child theme functions.php
- loading javascript CDN with local fallback (not jQuery)
- Dynamic wp_enqueue_scripts?
- Why do I have to specify all parameters for wp_enqueue_script to load my jquery in the footer? [closed]
- wp_enqueue_script() not working
- Load scripts only for selected template
- wp_enqueue_script JS code runs too late (after user begins interacting)
- Get localize of a loaded javascript
- wp_enqueue_script error with `ID`, `post_title`, `post_name` of none object
- How to enqueue a script on a specific URL that contains multiple parts
- Enqueue Script only over specific WordPress core file
- wp_enqueue_script silently fails [closed]
- How to include a JS file in this theme?
- wp_enqueue doesn’t load dependencies
- Loading newest dependency javascript module file in functions.php