Scripts should be enqueued on wp_enqueue_scripts
action hook, which runs after init
action. So dequeuing on init
won’t work because sripts are not enqueued yet. Before enqueued scripts are printed, wp_print_scripts
action is triggered so you can dequeue or unregister scripts safely at this moment:
add_action( 'wp_print_scripts', 'drw_timelinr_dequeue' );
function drw_timelinr_dequeue () {
wp_dequeue_script('jquery.timelinr');
}
add_action('wp_enqueue_scripts', 'drw_timeline_js');
function drw_timeline_js () {
wp_enqueue_script('jquery.timelinr2', get_template_directory_uri() . '/js/jquery.timelinr-1.0.js', array( 'jquery' ));
}
Related Posts:
- How to avoid redefining requirejs in plugin when another plugin also uses requirejs
- Edit all $wp_scripts at once to $in_footer = false
- Edit all $wp_scripts at once to $in_footer = false
- Trying to use wp_register_script/style and enqueu them from an array – getting an error [duplicate]
- Tips for using WordPress as a CMS? [closed]
- What Are Security Best Practices for WordPress Plugins and Themes? [closed]
- Conditionally enqueue a widget’s script/stylesheet in HEAD (only when present on page!)
- How to get the active theme’s slug?
- Plugin (or Theme) containing its own Plugins?
- Which method is best to enqueue scripts
- Disable author pages for specific users
- Set active theme via URL
- Get info (url) from already enqueued styles
- Migrating a File from Plugin to Theme and changing its path → instead create a REST endpoint
- Dequeue / Deregister script and replace it with a new plugin
- Add extra parameter in tag using script_loader_tag
- Why users disable the WordPress update?
- Adding Scripts in the Admin Area
- Overriding a function in wordpress
- I can’t upload a new wordpress theme from a zipped file
- Get list of sites that uses specific plugin or theme
- Set WordPress Featured Image For All Post Slugs Matching Image File Name in Specified Directory
- Woocommerce sidebar not loading in theme
- Include Max mega menu Plugin into theme
- How to remove all javascript in a theme wordpress?
- wordpress theme backend admin only
- Deactivate Plugin on Theme Switch
- How To Clean The Malware Infected & Hacked WordPress Websites? [duplicate]
- How to remove style and js from theme and add your own style and js where shortcode is used?
- How to get current post user id
- Re-naming a theme/child theme whilst maintaining updates
- Unable to upload wordpress plugins
- The problem with WordPress Importer
- How to disable CSS rule in Twentythirteen style.css?
- Linux Permissions and Ownership for WordPress
- Fatal error: Call to undefined function cmsms_theme_page_layout_scheme()
- Homemade plugin while using Themify Ultra
- Theme/Plugin installation through url on button click
- How can I position ShareThis buttons manually when using the plug-in? [closed]
- Does WP delete deprecated plugin/theme files on plugin/theme upgrade?
- How can I remove the WordPress-Version (?ver=5.x) from my plugin
- How to use get_template part in the plugin?
- How can I use get header from within my plugin?
- My single.php page does not show the related data to the post which is clicked
- Basic gallery plugin suggestion [closed]
- How to write “alt” tag in image for wordpress code?
- How to activate a plugin on the activation of a theme?
- WordPress plugin won’t show on some themes
- How to make a dynamic css class whose name changes every visit to confuse scraper
- How do I add a plugin dependency to my customized theme?
- What is it and from where it is loaded?
- Inserting Plugins Into Blank Space of Externally Designed WordPress Theme
- Enqueue script: link not working in page source
- Cannot add edit themes and add plugins after multisite update
- Load CSS files in header of Bones theme?
- How to handle a WordPress blog with articles in different languages?
- Remove updates text on plugin or themes list page
- How to prevent plugin, theme installation failures on WordPress?
- WordPress Cache delete on plugin uninstall
- Unknown theme modal source
- Remove a div class with condition
- How Can I Increase Breadcrumb Position Count (Starting From 2)?
- Main content of site not showing, but does show when logged in to wp-admin
- Ajax Call not Working in Plugin
- Changing the pointing of assets from old server to new server
- Hide Plugin Custom Post Type Menu Link
- Enqueue plugin for specific pages
- Hooking into the HTML header container
- Set up new WordPress domain using unclear files
- Genesis Child Theme – Customize body
- Why can I not deregister my style and script on custom post type?
- Unable to activate themes on localhost
- How to roll back WordPress version or prevent migration from forcing update?
- Multisite converted to Single Site can’t add new plugins or new themes
- plugins_url not returning correct directory
- How do I keep children of certain parent menus expanded by default on a sidebar?
- why my wordpress dont have toolbar like, plugin, themes and other?
- how to add custom css at top above all css file for specific url
- How to install jquery dotdotdot plugin for WordPress?
- How to link file or image from wordpress plugin dir to theme by using themes function.php, is it possible?
- Using activated_plugin to run code
- Theme styling for plugins
- Creating themes using the one Plugin (Toolkit)
- How to install wordpress theme’s plug-ins?
- White screen and can’t activate themes and plugins
- jquery-issue: cannot load the basic jquery
- Template from scratch: Sidebars not showing widget
- custom registration form [duplicate]
- Why do I get this “peer’s certificate issuer not recognised” error when trying to install a theme?
- Activate plugins by a theme’s functions.php?
- Site is setup statically – how to make it content managable?
- do_shortcodes() isn’t working
- Javascript as Jquery Function Call?
- Any plugin/theme available which suits my requirement? [closed]
- Two sites one PC
- How to escape html code?
- Elementor with system colors instead of kit colors [closed]
- Issue with customizer and widget page
- admin_enqueue_scripts using hook_suffix vs GET page
- WordPress menu dissapear when I add a parameter to custom post archive