You want to use plugin_dir_url()
:
$url = plugin_dir_url( __FILE__ ) . 'js/my.js';
Related Posts:
- Change the path where wordpress plugins are uploaded
- Which method is best to enqueue scripts
- How to call plugin path in JS?
- Absolute Path (ABSPATH) in WordPress is not working
- Migrating a File from Plugin to Theme and changing its path → instead create a REST endpoint
- Get uploaded image url
- WP Paths in a Plugin – how to include
- plugins_url function mixes system path and URL
- Added slug after URL permalink last slash returns different content
- Retrieving a path when dealing with composer packages
- Using arbitrary paths in page urls
- How to get path or root of plugin folder, not file or dir?
- Slashes stripped in ACF
- Correct Plugin File Path
- Absolute paths in backend for plugins after moving wordpress
- Replace image urls(absolute instead of relative) by using filter in single page
- Include my files in a plugin? [duplicate]
- Failed GET Request From admin.php To Fetch .min.js File From Unminifed Directory
- path of wp-content directory when we are on some plugin
- Get not the full path
- Unexpected plugin_dir_path Output
- How to tell if a script is being executed from a plugin, a theme or a child theme in WordPress?
- Server Path Information
- Include paths and functions for external scripts
- Register additional wp plugin directory
- WP-DBManager Plugin Can’t Find Mysql Path
- What security concerns should I have when setting FS_METHOD to “direct” in wp-config?
- What’s the preferred method of writing AJAX-enabled plugins?
- Get Product id from order id in Woocommerce [closed]
- force enqueue script to be first in order of prominence
- Hook for image edit popup
- WooCommerce ‘all’ orders no longer being displayed – how may I debug/fix [closed]
- Multi domain, multi sites with different themes and content
- Change post permalink to external URL from custom field
- Understanding apply_filters
- Master menu item for multiple plugins?
- Simultaneously post in both WordPress.com and self hosted WordPress blog
- Multi-Environment Set up
- Upgrade Private Plugin without Deleting
- get values from contact form 7 wp plugin [closed]
- Use plugin multiple times
- Overwrite or Replace code in WP_Footer
- Cron jobs not working in WordPress plugin in a VPS with VestCP control panel
- Creating mySQL procedure with $wpdb
- WooCommerce: Building a page with user input which is used to query order status and external API and return a result
- How to make a implement queue for scheduling tasks in WordPress?
- add custom filters to the event calendar plugin programatically to frontend [closed]
- After upgrade to php 7 plugin/them updates broke [closed]
- WordPress Integration with Google Groups
- Editable form for WordPress plugin options page
- wp-pagenavi getting 404 page not found
- remove add new post, if there is already one post
- Difference and examples of esc_attr__() and esc_attr_e()
- woocommerce with custom post type
- Multisite – maximum number of users with specific role
- Issue running db create table query from static method
- correct sql query
- SQL query, error
- Problem of encoding characters (apostrophes) in my posts publications
- Locked out of admin panel after installing HC Custom WP-Admin URL [closed]
- Restricting page access [closed]
- Use $variable from file1.php in file2.php (different file paths)
- Sanitizing file & directory form input
- What’s my optimal choice for remote access to my localhost sites?
- Widget for specific category
- Plugins successfully uploaded via FTP but they are not on my site
- How to call external functions from a PHP script in a WordPress plugin?
- How to hide post from Home page..?
- Unable to install plugins
- Why jquery option is not working when pass value using wp_localize_script?
- “switchEditors is not defined” with wp_editor() in jQuery UI tabs
- Error Using Audio plugin
- Troubleshooting Admin_Notice
- Images are broken in Wysiwyg Editor – ACF backend
- Adding Custom Endpoint in WordPress Rest API
- How to allow URL with filename & extension in wordpress?
- Plugin will not write background color to site
- Unable to update plugins or log out
- load plugin in code snippet
- CF7 Custom Recipient – Changing the text
- When the user entered an unauthorized url redirect to login page
- Add Cancel Button to a Custom Meta Box
- Customizer preview URL not updating when settings reset to default
- Products aren’t detected if CSV importer are used
- how to create database to use it in wordpress website?
- WordPress Feedback popup with date saved into table
- Plugin option for input box validation
- Exclude specifed files from plugin editor
- Show widget location borders for development
- Filter for modifying image on upload
- WordPress Related Plugin – Adding an image
- Show whether a post is plus or minus with Wp-Postratings
- Add A Button to WooCommerce Product Page
- adding a css file to my plugin
- Strict Standards: Non-static method in sidebar generator
- add_image_size is not generatin images of correct dimensions
- How can I delete the options from DB when the plugin is deleted?
- Ajax Load More stopped working (Plugin with repeater template, shows hidden Button)
- WordPress Share Buttons Plugin: How do you make the WordPress Share Buttons Display Vertically?
- Plugin translations are not loaded from translate.wordpress.org