You can use script_loader_tag
filter to fulfill your requirement. add below code in your active theme’s functions.php file. it will add extra parameter in your script tag.
function add_attribute_to_script_tag($tag, $handle) {
# add script handles to the array below
$scripts_to_defer = array('wpfrank-ptbw-pinit-js');
foreach($scripts_to_defer as $defer_script) {
if ($defer_script === $handle) {
return str_replace(' src', ' async defer data-pin-hover="true" src', $tag);
}
}
return $tag;
}
add_filter('script_loader_tag', 'add_attribute_to_script_tag', 10, 2);
Related Posts:
- force enqueue script to be first in order of prominence
- Dequeue / Deregister script and replace it with a new plugin
- How to avoid redefining requirejs in plugin when another plugin also uses requirejs
- Problem in loading javascript in footer
- React JSX in WordPress Plugin Development
- Enqueue WordPress plugin scripts below all other JS
- How can I remove the WordPress-Version (?ver=5.x) from my plugin
- Is there a loading priority for login_enqueue_scripts?
- Deactivate JS Script in Plugin Shortcode
- Remove / overwrite some functions in buddypress.js
- Add type to enqueued script inside plugin
- How to enqueue some javascript source once per page
- Why can I not deregister my style and script on custom post type?
- How to include code only on specific pages?
- When can you get current page ID and initialize hooks right after?
- Declaring script dependencies between scripts enqueued with different action hooks
- Why is the unrendered widget number `__i__` showing up in the JavaScript but not in the HTML?
- How to Reload the Dashboard After Clicking Update in Quick-Edit?
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- White text on white background in TinyMCE when wp_editor is called in WP 3.9
- What’s the best plugin for allowing javascript in a post or page? [closed]
- Is it possible to filter the wp_footer() scripts, read the content, and insert them inline?
- Disable / Deregister all JS from all plugins
- Creating an Exit Confirmation Popup
- wp_enqueue_script fails to include in footer
- How to create popup same as wordpress popup feature
- Passing RichText attributes to function onChange
- Gutenberg List Extension Block
- Avoiding Duplicate function names in Post Loop (WP_Footer script)
- JQuery not working in my plugin [closed]
- prettyPhoto media loading very slowly in Chrome
- Pulling data from custom plugin settings using PHP shortcode and Javascript
- Using custom JS plugins with WordPress?
- Override Javascript in a Plugin?
- How to disable specific plugin in mobile version?
- Updating the Drag-To-Share eXtended share URLs?
- add input in custom javascript from WordPress pages/posts
- accessing wp.media api from a tinymce plugin
- How to load wp_editor via AJAX
- Redux Framework: Page freezes on typing in Editor
- Create shortcode to echo javascript
- Redirect to another page using contact form 7? [closed]
- JavaScript in a PHP plugin
- How do I add some javascript validation to the admin interface form’s onsubmit?
- How to execute a plugin on a single page only?
- MediaElement.js works on one site but not the other?
- Pass user role to javascript code inside body
- How use wp media upload liberary in react components?
- How to use custom Javascript code inside a plugin?
- Adding a simple Javascript file with a plugin
- Executing Javascript in Plugin
- Custom CSS not being added by plugin
- why the wp_register_script doesn’t work for register_activation_hook
- force jQuery to load in the head
- Dropdown menu on click change
- What’s the default setting for including a in a post
- What is the most effecient way of enqueuing scripts based on the current plugins template?
- Code for unique user visit count on every page WordPress
- Send Array from JS to php file then insert it in wp database through a plugin
- Set Button in PluginDocumentSettingPanel Content (WordPress Gutenberg)
- WordPress load same script two times
- How to override Plugin javascript function : $(‘body’).on(‘change’,’.class’)
- Connect / Login WordPress Hosted Website or Blog with NodeJs
- login form should redirect to register page for in 1st login next time it should redirected to home page
- Fixed: Console.log twice in the edit function
- Javascript embedded disappears for editors
- How to fetch WordPress database values in JavaScript widget
- Possible way of having multiple Gutenberg instances for a page?
- Trouble with AJAX using GET
- Woocommerce add products to cart
- How can I create a secure file download in WordPress?
- front end editor creation for Restropress plug in – displaying information from a WP admin area, on a different URL
- WordPress site hamburger menu toggle not working
- How to get Angular app working in WordPress plugin?
- Custom Field used to allow a Free Story; no longer works
- Create a form and have custom menu display based on user answers?
- Enabling plugin on specific pages and subpages
- Problem in functions.php file
- how to send two forms with one click (script ninjaforms id)
- How to print shortcode with js in visual composer?
- Link in navigation menu send user to different page if mobile?
- How to limit each front-end user to view just his own uploaded files on Amazon S3?
- Creating a user ‘add custom field’ section
- Javascript not working
- Need to hide an element depending on date and post category
- contact 7 plugin stops some pages from working properly
- Can’t insert files in other inputs
- Is it possible to run javascript on plugin deactivated?
- How do I output user_registered time in my correct timezone?
- Ajax in Plugins: returns the whole page
- Enqueue scripts in the footer
- How to tweak a plugin without preventing it from updating
- WordPress shortcode plugin not working
- FacetWP: Plugin breaks button/modal functionality inside searchable content area
- Defer parsing of JavaScript [duplicate]
- How do I put a word-press blog into my static site without installing wordpress on server?
- Count div with class (.length) only shows 0 [closed]
- how to embed a crop feature for cropping images uploaded by the user
- how to show selected options drop down menu values in attributes field in after saving post.php
- Vanilla javascript in custom gutenberg block not working