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
- Does the number of downloads displayed for a plug-in in the WordPress.org plug-in directory include automatic updates?
- Help making my pagination plugin better
- Which method is best to enqueue scripts
- Function to activate WordPress theme inside a plugin
- What is the correct way to check if WP_Filesystem can write to a directory without aking for username / password?
- Is there a WordPress Plugin that allows voting “does this coupon work” on specific links like Retailmenot
- Pass A Value From Outside To A Plugin Variable
- shortcode doesn’t work
- Built in admin ajax hooks?
- Force plugin to fail activation
- How to load default scripts included with WordPress correctly?
- Could someone please help me to add category id with in this query so this will return posts from a certain category?
- What are the benefit in adding hook in the init() hook?
- building plugin and it is displaying above plugins page
- load_theme_textdomain path
- Dynamic CSS Vs Inline Issues in Code any Way around in a WordPress Themes?
- Is license need for free wordpress plugin
- plugin development: problem with functions
- Building plugin with changeable custom post type values…advice needed
- How to get all of the activate_plugin action parameters?
- What can be reason for no plugin-strings available under stable section on translate.wordpress.org?
- Why Is This Code Causing The Admin Bar to Disappear?
- Displaying Custom Sidebar Without Modifying Theme’s Core File?
- Include a php file from another plugin
- How do I make a secure API call from a shortcode when a button is clicked?
- WordPress REST API Plugin Development – Add Custom Endpoint
- Hook into the rendering of a WordPress Template
- Can the uniqueness of the plugin file/plugin slug and version number be trusted?
- I changed .live() to .on() but change is not reflected on the server
- Redirect logged in user to somepage on every page view?
- A question of etiquette when forking a plugin? [closed]
- how to request a script more than once in wordpress
- How to make a Product page without ordering and database
- wp_options not returning value for logged out users?
- Gutenberg default attributes are empty when accessing in edit
- Hide all Admin Notices and move on a separate page
- Adding shortcodes to multiple pages with function
- Get a list of Product Categories inside a loop
- Can you develop themes and plugins while using the hosting services BlueHost? [closed]
- WordPress plugin changes not updating
- wordpress ajax pagination object value does not change
- Google analytic issue in wordpress
- What’s the preferred method of writing AJAX-enabled plugins?
- Shortcode registered from a plugin not recognized
- wp_update_post call really slow when official Facebook plugin is installed
- _e in wordpress +
- WordPress Code Access to Restricted Content without Registration
- Meta box not displaying on the plugin page
- public custom posts not showing in my wordpress plugin