You have a basic mistake in your code. The following code
if ( !is_page('my-page') ) {
means that if you are not on that page, deregister the scripts. Have a look at the php operators
! -> Not !$x True if $x is not true
Also, why not exclude this specific page when you initially enqueue these scripts, something like
add_action( 'wp_enqueue_scripts', 'my_register_javascript', 100 );
function my_register_javascript() {
if ( !is_page('my-page') ) {
// ENQUEUE/REGISTER SCRIPTS
}
}
It is much cleaner and more efficient. I don’t see the point in registerring a script and deregister it again. Rather register the scripts conditionally from the start
Related Posts:
- Problem using is_single() to enqueue script from functions.php
- Enqueue scripts not working with if is page conditional tag in functions.php
- wp_enqueue_scripts called twice?
- How to load scripts/styles specific for a page
- WordPress Enqueue for homepage only, functions.php, wp-framework
- WordPress function like is_category for subcategory? is_subcategory?
- Enqueue Script with data attributes
- is_front_page not working in functions.php
- disable comments if array exists
- Most elegant way to enqueue scripts in function.php with foreach loop
- wp_register_script not loading as expected
- Conditional tag is_page with a custom post type
- Dequeue Scripts and Style for Mobile not working?
- Enqueuing External Javascript functions.php
- How to enqueue JavaScript for specific WordPress pages only?
- Enqueue script o style only if a template part is loaded
- Enqueuing Script in functions.php vs on the page
- Dequeue script in template isn’t working
- Limit posts only on home page – ideally in functions.php
- If is multiple page templates
- How do I get a child theme to load scripts from the parent theme?
- wp_enqueue_script add integrity parameter
- Passing arguments to my function with do_action and add_action is not working
- When using wp_enqueue_script(); in a theme why don’t we use add_action?
- Load JS Script only for custom post types
- Register vendor JS/CSS only on pages that require them?
- Why won’t my scripts load?
- Conditional read more adjustment
- Not sure if enqueuing js scripts properly
- How add various functions within 1 conditional?
- enqueue styles for only mobile wp
- how to en-queue jQuery to load before the tag
- jQuery does not work
- enqueue_script with filemtime javascript not working
- add_action wp_enqueue_script priority level only works for admins
- Scripts not loading when using the wp_enqueue_scripts action
- Why does get_template_directory_uri() not include “www”, only for enqueued stylesheets?
- In jquery use php variable to execute an enqueued jquery file
- Testing for a shortcode using a function. 404 page throwing PHP Notice
- is_page() or is_single not working
- Enqueue script on every page except one
- functions.php and conditional tags
- Run a jquery script on on a certain template page
- How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)
- issue with if/elseif in_array inside foreach loop display only one post
- wp_enqueue_script | Help me figure out what is causing jQuery is not defined
- Load JS file only in specific template
- Theme JS is available but theme CSS isn’t
- 404 when enqueue_script using plugin_url
- How to load jQuery in TOP of wp_footer?
- video.js not enqueueing?
- Include Jquery libraries in wordpress theme?
- Problem enqueuing scripts on not single posts
- Call two different function.js depending on page
- Why I can’t load my JavaScripts using an hook inside my functions.php file?
- Function to echo (or display?) wordpress tags in the head section
- is_home() not working in functions.php file
- If is_single in functions.php
- Enqueueing scripts selectively & activation where needed
- Why is this function crashing my wordpress installation? [closed]
- colorbox not loading in
- Fatal error: allowed memory size when after using enqueue_script
- How to use wp_enqueue_script properly?
- Get webpack to work on child theme
- Advanced method to control cache of enqueued style/script
- How to load a css file depending on the current role
- WordPress wp_dequeue_script remove all other scripts
- Add custom css file after plugin css with WordPress Child Theme functions.php
- Is it possible to load recaptcha script only in url with fragment identifier (#)?
- Enqueue script if not page template
- Test CDN link from function.php or wp_enqueue_script/style?
- is_product_category(‘Services’) not working
- Why does my wp_enqueue_script() only insert the script for logged in users
- Unable to declare AOS library in functions
- WP Enqueue Script Error
- How do I dequeue a Stylesheet, stored in an ‘Assets’ folder?
- method to fetch entire tag list on archive.php
- I need to ‘wp_dequeue_script’ and ‘styles’ and ADD a bunch of other css and js
- I need to completely ‘wp_dequeue_script’; what’s the best way?
- True parameter but jquery register in header and not in the footer with wp_register_script
- Why is style.css not loading through the functions.php
- Adding an IF ELSE to a function
- WordPress Jquery+scripts enqueue issue
- Different body image backgrounds on different pages, posts and categories
- how to display featured image for single post for a specific category
- How to wp_enqueue_script with html?
- custom post with loading script per single post
- wp_enqueue_script only works outside of action
- Load CSS conditional on custom field is present
- java script error Uncaught SyntaxError: Unexpected token ILLEGAL
- admin-ajax.php nulls all php variables
- restrict access to specific urls on a specific period of time
- Change conditional tag in wordpress without editing the core files
- using enqueue_script in a shortcode isn’t working
- Using array page name together with page id to deregister script
- Remove snippets of JS from core
- PHP Notice: Function is_page was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false
- WordPress – Notice: Function wp_enqueue_script was called incorrectly
- dynamically import array from another js file in WordPress
- Loading newest dependency javascript module file in functions.php