First get datetime
stamp of your js
file’s last modification, and use it as fourth parameter of wp_enqueue_script function:
$path="full path to your script file");
$handle="your_handle";
$src="https://wordpress.stackexchange.com/questions/283374/path of the script, relative to the WordPress root directory";
$depts = array(); // dependencies, if any
$ver = filemtime($path);
$in_footer = false;
wp_enqueue_script($handle, $scr, $depts, $ver, $in_footer);
If the datetime stamp changes, your updated script will be loaded, otherwise the cached script will be loaded.
Related Posts:
- W3 Total Cache: Load CSS asynchronously for better PageSpeed score? [closed]
- How do I minify a plugins CSS/JS code?
- Execute inline javascript in wordpress after page fully loaded
- Caching of combined CSS and JS fails because of losing MIME types through combining by PHP
- How to load wp_editor via AJAX
- Getting a custom Gutenberg component’s state from outside that component
- How would implement StackExchange ‘Questions with similar titles’ for the FAQ on my wordpress site
- What happened to convertEntities?
- Create Proper WordPress Ajax Request in JavaScript, NOT jQuery
- Can I ignore caching of a plugin in W3 Total Cache? [closed]
- Why is the unrendered widget number `__i__` showing up in the JavaScript but not in the HTML?
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- Getting “Fatal error: Call to undefined function wp_cache_get() in option.php” after updating a cache plugin [closed]
- How do I use WordPress PHP functions in my Javascript code?
- How can I make the “Preview Post” button save and preview in the same window?
- Difference between register_block_type & wp.blocks.registerBlockType
- Has anyone used require.js for handling plugin scripts?
- Can I share predefined fonts from theme_support with a gutenberg component?
- javascript onload calling a function of a plugin
- WooCommerce & Caching [closed]
- Where should a plugin or widget cache its results?
- Write to / remove from default .htaccess file from plugin?
- How can I add Expire headers to images?
- How to load plugin after page is loaded – pagespeed issues
- Shortcode button dosent work for all posts. Work for first post only
- React JSX in WordPress Plugin Development
- Possible htaccess configuration issue for HTTPS websites by WP Fastest Cache plugin? [closed]
- Is there an earlier hook than login_head or login_enqueue_scripts?
- Correct way to perform non-cacheable DB query
- Can I use custom CSS and js plugin to put JavaScript in to validate my forms
- add image crop function like in wp customizer
- Calculate price and display on woocommerce product single page under price (simple price, variable price) [closed]
- Executing Javascript when a New Post is Published
- Set featured image using javascript in post editor
- Display encrypted content on my website
- How to edit content before post update
- create link/button to purge cloudflare cache on post
- wp.media javascript issue with on select
- WordPress + JavaScipt + AJAX + MySQL: insert query for form
- Advanced AJAX Page Loader ignores other JS code
- WordPress 3.8.3. custom theme – sliders won’t load js/css files
- Using TinyMCE in plugin?
- How to handle cookies from a WordPress plugin on a cached page?
- w3 total cache and sitemap.xml
- Adding (image) caching to my Tumblr widget
- Deactivate JS Script in Plugin Shortcode
- Remove / overwrite some functions in buddypress.js
- how to insert a HTML form into a javascript popup?
- Display a consistent Google Plus icon on ALL pages of my site
- Add type to enqueued script inside plugin
- After updating the WordPress getting a syntax error in the console
- How to generate an all in one WordPress New content, plugin and theme update report on a website? [closed]
- get specific value of a array | PHP
- How to use custom Javascript code inside a plugin?
- JQuery needs to be defined in , but Gravity Forms is defining it in the
- How to save comment name email url fields?
- Meta slider plugin only works after first refresh – Object has no method ‘flex slider’
- Javascript from Easy-Fancybox place into footer
- What archive plugin works with W3 total cache? [closed]
- uncaught TypeError: Cannot read properties of null (reading ‘classList’) custom plugin
- Directorist – Dropdown doesn’t open
- How to apply to hide TinyMCE (wp_editor) on button click
- Upload Javascript and json webpage to wordpress
- Memcaching recurring SQL Queries
- how long do restored versions take to go live?
- Stop a script on a single page
- Get the link title attribute and send it google analytics as custom label via google tag manager using beehive pro for WordPress
- Calling PHP function with AJAX
- How can I add a custom Javascript snippet to display my feedback in footer?
- Website always load twice on start
- How to add defer to WordPress Plugin javascript? [duplicate]
- Multiple image selection custom widget
- How to reset WP plugin?
- Custom Field used to allow a Free Story; no longer works
- How to solve Blocked a frame with origin from accessing a cross origin frame error in wordpress?
- Speeding up WordPress on a Local Network
- How to use information from the database in the front-end?
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- How to print shortcode with js in visual composer?
- Number format in thousands on highcharts in wpdatatable plugin
- Disqus comments count taking long to update
- Embed Javascript code to registered users only
- Best use adding user generated JS/CSS to a theme with a plugin
- How to set up php,javascript and css to allow for our finished product to be displayed within a page?
- Ajax, jQuery and WordPress
- Is it possible to run javascript on plugin deactivated?
- Move specific javascript to the footer
- Load css classes after using ajax calls
- Eliminate Render blocking CSS?
- How to make a rest style plugin?
- How can I include properly javascript files in my wp plugin [duplicate]
- Adding a script & php to functions.php
- How to access values from your own settings page in javascript?
- Refresh server side rendered block in Gutenberg without changing attributes or its content
- How do I call an action hook into wp_ajax hook callback function
- I want to display data last 7 days with date wise in chartjs?
- this code is fiven by chat-gtp but nothing match even I key in the value of a cell. help!
- Use custom Javascript for a custom Elementor Widget [closed]
- How can I wordpress cache a database request with no existing plugin?
- Request initiator chain contains old CDN