The function wp_enqueue_script takes a parameter $ver that you can use to automatically add an version parameter to the URL. To always load the newest version of your Javascript-File, you can use the php filemtime-function to give the timestamp of the modification date.
In a Plugin, use like this:
wp_register_script( 'my-awesome-script', plugin_dir_url( __FILE__ ). 'assets/my-awesome-script.js', array(), filemtime( plugin_dir_path( __FILE__ ). 'assets/my-awesome-script.js' ), true );
Happy Coding!
Related Posts:
- How to add more elements to an already existing section in Gutenberg
- Working with a non-React external library in a custom block
- Masonry gallery block is working in the block editor but not the template editor
- How to import the imagesLoaded and Masonry libs that come with WP in a Gutenberg block?
- Embedded data and the _fields parameter in getEntityRecords
- Force-update the meta variable first set using `var [ meta, setMeta = useEntityProp( ‘postType’, postType, ‘meta’ );`
- How to build BOTH non-block components and blocks present in the /src directory using @wordpress/scripts
- How to add an additional dependency to a block index.asset.php file
- Why is the Gutenberg editor not recognizing my updates?
- How to transform a shortcode into a block
- How to re-render Gutenberg component when object instance is available
- useSelect() plus resolver result is serving cached data incorrectly
- Gutenberg DatePicker component with time set to zero
- How to render HTML content using the Interactivity API?
- Extend WordPress Gutenberg core/navigation-link
- Trigger Javascript on Gutenberg (Block Editor) Save
- Gutenberg – remove / add blocks with custom script
- How to use wp.hooks.addAction() in React JS/Gutenberg?
- Show control conditionally in Gutenberg
- Gutenberg custom block plugin with custom image sizes
- How to get the ToggleControl Gutenberg component working for a PHP Block
- Hooking a callback into the code within a Gutenberg block
- conditional layout based on if Innerblocks is not empty
- Gutenberg extend blocks add new class name
- initial open/toggle PluginDocumentSettingPanel panel in document setting block editor gutenberg
- What do the args for Gutenberg subpackage “hooks” function “doAction” mean?
- How do I fire a snackbar notice in admin?
- Why is this gutenberg custom format button only available from the toolbar as a dropdown?
- Setting HTML properties in a Gutenberg plugin using WordPress settings
- Provide specific example for block variation
- Use useSelect/useDispatch instead of withSelect/withDispatch
- How to handle Gutenberg wp.data async errors?
- Set current tab on a Gutenberg TabPanel component from outside that component
- Block editor: How to check if block editor has initialized and populated the data store?
- Load script after block is inserted
- Gutenberg block “This block appears to have been modified externally” on save
- How do I access site and block editor state data and use `useSelect()` or `withSelect()` to bind it to my components?
- Gutenberg passing block attributes to component in ES6/ESNext
- Can the index.asset.php file be used with the enqueue_block_editor_assets action?
- var is undefined in a Gutenberg block
- Gutenberg add extra attributes to custom format
- Using wp.data.select get actual tags (not id’s) used in post
- How to remove p / br elements from gutenbergs editor
- Programatically update posts in database from one block to another using transform
- Gutenberg getMedia() in post query doesn’t return all featured images
- How to transform a legacy widget into a block
- Gutenberg select categories
- Listening change event of taxonomy term checkboxes in Gutenberg editor
- Gutenberg get core data – search
- What is the correct way to import the blocks-editor?
- Gutenberg extend blocks add new class name
- How to add classes and events to image in javascript using Gutenberg?
- Checks when fetching data from multiple REST API endpoints in Gutenberg
- Search for a keyword across post types in a Gutenberg component
- Using apiFetch for retrieving post data in Gutenberg
- Add custom classes for blocks in editor based on custom attributes
- How to load an additional script for a block in the block editor?
- useSelect second parameter
- How can I allow HTML in Gutenberg UI elements help text?
- Trigger wp-embed via JavaScript to refresh iframe preview?
- Gutenberg getBlockIndex in save() function
- Widgets and Post/Page edit/new blank, console errors only, no server errors
- Trying to turn the Edit function into a class to be able to use React lifecycle methods
- Gutenberg richtext block vaildation failed
- UnitControl – Block has encountered an error
- Conditional save return on Gutenberg Block
- Can I alter the block editor’s paste text behavior?
- Custom Gutenberg-Block esnext pass variables
- Building a Featured Gallery component for Gutenberg
- How to read inline-CSS from Gutenberg block?
- Custom Gutenberg block: access dom element via JavaScript
- Custom Block – save.js function not saving attributes
- Gutenberg – useEffect manipulate DOM after block re-renders DOM
- Problem extending a core block
- Including dependencies using @wordpress/dependency-extraction-webpack-plugin
- Gutenberg – dynamically created element: how to set onChange?
- Custom block update rendering when reused
- WordPress Gutenberg Ajax request
- WP Gutenberg – custom block with two content fields
- How do I make a savable preview like Youtube Gutenberg block?
- Gutenberg Edit Block Inspector Controls and save
- Spans in gutenberg
- iFrame onLoad in custom Gutenberg block
- Block pattern conflict with custom block
- Table block variation with header section activated
- Filtering Gutenberg Components, not Blocks
- Where to include JS library in gutenberg blocks
- How to delete child block for associated parent block
- How to detect if we are in the Site Editor part of the Block Editor (as opposed to editing a Page/Post) in JavaScript?
- How can I show a Slot/Fill in the block editor
- Is it possible to add javascript to template parts
- How to add a css class to postTitleWrapper in Gutenberg?
- How to change the selected Template using javascript?
- Additional CSS classes not being added in Gutenberg editor
- How do I filter/modify the updated content on save using javascript?
- config @wordpress/scripts with webpack and postCSS features
- Gutenberg block: add a multi-select for posts
- How to execute some javascript code in the editor when a block pattern is added?
- useBlockProps() nests wrapper with class name inside block wrapper in the editor
- Why Is wp.editor Not Adding the ”Add Media” Button When I Initialize It?