jQuery Migrate is nothing but a dependency of the jQuery script in WordPress, so one can simply remove that dependency.
The code for that is pretty straightforward:
function dequeue_jquery_migrate( $scripts ) {
if ( ! is_admin() && ! empty( $scripts->registered['jquery'] ) ) {
$scripts->registered['jquery']->deps = array_diff(
$scripts->registered['jquery']->deps,
[ 'jquery-migrate' ]
);
}
}
add_action( 'wp_default_scripts', 'dequeue_jquery_migrate' );
This will prevent the jQuery Migrate script from being loaded on the front end while keeping the jQuery script itself intact. It’s still being loaded in the admin to not break anything there.
In case you don’t want to put this in your own plugin or theme, you can use a plugin like jQuery Light that does this for you.
Related Posts:
- List of all theme customizer control types?
- Installing wp3.2.1 on IIS; getting empty sessions
- WordPress widget in custom theme
- Specific Loop For 2 Within Each
- How do I enable HTML5 prefetching on this page?
- Anything I can add to functions.php to make text widgets accept PHP?
- How to find the output of contact form 7 shortcode? [closed]
- Is it necessary to upgrade to php7? [closed]
- How do I access the media settings
- How can I output a php value into a JS file within WordPress?
- Set post title based on first h2 element in the content section
- WordPress to end support for PHP 4?
- Why does WordPress remove my variables in the URL?
- get current custom post ID by WP_Query method
- Can I prevent the user from adding more than two levels deep of terms inside of a taxonomy metabox?
- Show css depending on activity type in BuddyPress activity-loop [closed]
- Mute Debug Messages from Plugins
- Reprinting tags with all attributes
- database sent to a JSON file
- Settings API callback function inserts html quotes from nowhere
- can i fetch a custom metabox data in another page or post type?
- Call to undefined function get_userdata() in plugin
- ‘Post-thumbnails’ feature does not seem to register
- multiple where condition in result query
- Featured or last post with a different WordPress style without plugin
- How to get User Time Zone in WordPress?
- Display css ONLY on most recent post of specific category?
- Different SMTP based on domain
- Calling PHP Titles inside Javascript Markup
- How to replace the default domain on wp get shortlink
- show recent posts php code error?
- add the value of a variable returned in a while loop [closed]
- Show Featured Image Dimensions and size frontend with shortcode
- How to remove/hide collapse menu for user/subscriber?
- How do I edit the terms output args or array data?
- Gutenberg Blocks and get_option() for styling
- remove values within an array user meta
- WP_QUERY post_in problem
- How to get post titles by post ID and integrate with my code?
- how to get data from two different table from wordpress database
- custom taxonomies not working
- Should I set a page as “No-index” if I include it’s content within the front-Page.php via this method?
- How does Permalink work with the AMP plugin after Removing Parent Permalink Catalog from Posts
- WordPress: Redirect Main Site to Subsite in Multisite Where user is NOT logged in
- Exclude category and post from loop in custom category.php
- Menu to the right of screen on desktop using Bootstrap 4
- Exclude a category slug on pagination
- Display specific main Sub Nav on Woocommerce product pages
- Perfmon performance counters on WAMP
- Page 2+ of taxonomy archives does not recognise sort-order from dropdown
- Not logged in when using http
- Is this correct get_template_part() in WordPress?
- Editing a WordPress plugin to add my own functionality
- How to show value from ACF plugin field in e-mail?
- Where to store the images of a custom WordPress theme?
- Exclude specific product tags from related products in WooCommerce 3+ [closed]
- How can I fix my pagination?
- Insert PHP into wordpress page [duplicate]
- How to remove the intro animation which appears during the load up of some WordPress themes? [closed]
- Why can’t I enter the wordpress admin interface?
- Show div only if product has attribute
- Create guest author page via php
- hello can you advise how to fix the error?
- How to hide header and footer from page template
- 404 after removing “category” base in wordpress
- Is there a way to get wp_editor (tinymce) content?
- Exclude Everywhere but Admin Area?
- Use URL query string in img src attribute
- Getting a specific “title for a section” only on Startpage?
- Frontend redirect after delete post in wordpress
- ACF Image Alt Tags not loading WordPress library meta’s alt tag
- Change date/time format in custom plugin
- Displaying custom meta box value in a custom post page
- How to pull the current user’s email and insert into a script placeholder?
- Sorting a custom post type in pre_get_posts
- I have an error WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version
- How do you create a front end form that enables the editing of member-specific custom fields in WordPress?
- How to use a conditional statement in a post loop but not count towards the “posts_per_page” if false
- How to make multiple custom taxonomies sit under custom post type slug?
- In WordPress how do you remove render-blocking CSS manually without a plugin?
- how to check elementor is widget is active or loaded
- ask about add_rewrite_endpoint query_vars
- PHP – Having $_SESSION as an array and adding $_SESSION to array
- SQL query to retrieve the number of WordPress posts with all given categories
- Saving meta box data from selected option’s value in database is not working
- Create a custom plugin with dynamic child pages listing database records
- Word press – JSPDF – Sending PDF as attachment from wp_mail – Special characters
- I can’t log into my website , it says “Error: Cookies are blocked due to unexpected output”
- Styling best practices for single pages/templates
- Link on post title only if post have content
- if get_post_meta do something
- How to save a post to a Custom post type and copy the information to another Custom post type?
- Save_Post change Custom Post Type Post title to post id number
- Sidebars panel in customizer
- WordPress If else statement to hide or show a div based on population a field
- Ajax infinite scroll random order shows duplicate posts on custom post type
- RTL in WordPress or Elementor editor
- Bulk data save in custom table
- WordPress @include( ‘template-config.php’ );
- Is there a hook that I can use when a fatal error occurs?