Yes, this should be correct. Is_single returns true on single post pages, both normal and custom post types. Note that if you also want to run your script on pages, you will need is_singular. The latter allows you to specify which post types the script should be included with, so it gives you more flexibility.
And yes, this should work for all WordPress blogs, though you should always wonder what happens if some other plugin interferes with yours. There’s no 100% guarantee that it will always work.
Related Posts:
- Pass PHP variable to javascript
- Handling jQuery Component Collision
- Is dynamic forms/entries possible in Widget?
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- Editor not displaying dynamically after clicking on the button
- How to fetch serialized data from wordpress options
- Why is my ajax call refreshing the page?
- How do I use WordPress PHP functions in my Javascript code?
- Admin-ajax.php is dying “0” without processing function
- Get image URL from media library in input
- How to create popup same as wordpress popup feature
- Only execute jQuery function(on document ready) on the page has shortcode from plugin [duplicate]
- jQuery function didn’t work in my plugin
- Handling jQuery Component Collision
- Check if email address exists front end with AJAX in a plugin
- Best approach to fetch data from wp options to js file or php file
- Ajax contact form widget plugin data not insert in database
- jQuery for custom plugin not working with Divi theme
- How to prevent plugins from loading jQuery
- Create shortcode to echo javascript
- How to add an element right after the article using jQuery?
- How to add a dvi tag to a shortcode then change a generated text using jQuery
- Save user total active time after login in wordpress [closed]
- jQuery code didn’t run on my plugin
- The Events Calendar Plugin – List View Background Colour Issue [closed]
- Ajax request sends url rather than data
- Adding a jQuery modal dialog to the admin area
- Pass PHP variable to javascript
- wc_get_template_part doesnt display the content [duplicate]
- How to properly enqueue jQuery knob on WordPress without conflict?
- update_post_meta is not working for me when I use e.preventDefault for update button
- WordPress Ajax request “Failed to load resource: the server responded with a status of 400 ()”
- WordPress Thickbox Navigation Issue in Gallery
- Dynamic input fields in WordPress Plugin
- Overwrite js code using WP_Footer
- Not displaying Woocommerce product page in lightbox
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- Overwriting Plugin’s Ajax callback function from theme
- Storing Array of values into wordpress options
- Can’t find variable is_single in my jQuery plugin
- Javascript in plugin not working
- How to Add Jquery FullCalendar in wp plugin in admin
- WordPress ajax not working in registration
- How to add jquery to my custom post type wp plugin
- Ajax, jQuery and WordPress
- How to get site homepage from plugin?
- get_option include in my adsense
- Ajax in Plugins: returns the whole page
- Load css classes after using ajax calls
- Integrating WordPress Content into a jQuery Slider
- Jquery post responses 500 error after some time and lastly an 503 error
- Woocommerce attatch files and custom input meta to cart items and then to order
- Ajax response from Media Selection does not update ALL information more than once
- How can i change the texts of plugin (created by me) in wordpress admin?
- WordPress : Explain Plugins & Theme string value in database
- modify plugin to support RTL
- Prevent direct access to WordPress plugin assets?
- Bulk update wordpress posts
- How to automatically add edit link on frontpage post of any wordpress theme?
- plugins_url() works everywhere but wp_reqister_script()
- Is there a plugin for automatically adding a word or symbol after a trigger word? I.e. Like a search and replace but more like search and add? [closed]
- Integrating boxtal PHP library into a custom WordPress Plugin
- Sanitize $_GET variable when comparing
- show my own admin_notices after a post has been published
- How to Show Author image and url in WordPress plugin directory? [closed]
- WordPress plugin: efficient way to store large data
- Custom characters of tinymce editor are saved as question mark
- Custom Module, Extending WP with a Plugin?
- How do I profit from a Plugin?
- How to automatically activate users after registration without activation email?
- Themes conflicts and overrides my WordPress Support widget Plugin styles
- Disable Author Archive just for certain roles in bulk
- Seperate plugin and theme files
- I created a plugin with ‘view page’ that uses MYSQL + PHP. When I use wp_insert_post(), it turns everything to HTML
- list of custom post by custom field in frontend
- How to implement color picker from WordPress in my boilerplate plugin?
- custom post type plugin error [closed]
- How to get a specific string from a url
- Does anybody know how to insert a complete jquery plugin into a wordpress elementor-page?
- WordPress rewrite rule depend on meta values not ids
- Problem with wordpress has_action() function
- In woocommerce, is there any way to empty wordpress default mini cart when order placed?
- Admin menu hilighting wrong item for CPT
- ajax voting for custom post type
- Inactive Plugin Files
- Saving an array to get_options
- Plugin – including external javascript calling google maps
- Help me with my first very basic plugin
- HTML link within my plugin settings page
- How to create post comparison in wordpress
- How can I create a navigation menu in the sidebar that can also act like a slider?
- How to create a sharing marketplace with wordpress for bicycles?
- How do I set register_meta for a specific CPT?
- How to Enfroce Domain Licensing Limits? [closed]
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- Update Content for a Custom Block Toolbar Button
- Submitting form to admin-post.php WordPress
- WordPress Throwing Deprecated Errors on its own Files
- How can we extent core/group or cover block?
- Need to add custom cart item data