Checkout – wp-includes/plugin.php#L585
plugin_dir_url()
function internally uses plugins_url()
to get the link to plugin directory.
plugin_dir_url()
This will return url of the plugin directory with a trailing slash at the end. So this can be easily used to link to the plugin directory.
e.g –
http://www.example.com/wp-content/plugins/foo/
plugins_url
If no arguments are passed this will deliver the same result as the above function; but with or without a trailing slash at the end. This can be configured to link to files within plugin directory; a useful shortcut.
e.g –
plugins_url( 'img/bar.jpg' , __FILE__ )
will return a url like
http://www.example.com/wp-content/plugins/foo/img/bar.jpg
Related Posts:
- Why isn’t is_page working when I put it in the functions.php file?
- Add image size if page template
- How to load parent_theme functions.php before child_theme?
- How to create thumbnails for PDF uploads?
- How to override function in functions.php of parent theme?
- Override a plugin class function
- Default content for a post in one category?
- Copy and delete a directory with WordPress functions
- change the comment time output to: X time ago instead of actual date and time
- Creating a table from shortcode avoiding wpautop for each row
- Including a function into a theme
- redirect wp-login.php to another page
- wp_register_script not loading as expected
- Problem with tag
- Simple/basic use of get_current_screen
- How do I redirect upon login a specific user based on role?
- Shortcode to insert menu in page body?
- Error message : Call to undefined function request_filesystem_credentials()
- change billing and shipping address 1 and 2 field placeholders [closed]
- override parent theme configuration in child functions.php
- Search user metadata with checkboxes via ajax (almost working)
- Sanitize slug title
- Add function to Simple Twitter Connect to not Tweet pages
- Hard-coding custom menu elements for menu manager
- How to use wp_trash_post (or wp_delete_post) for deleting a (or all) post(s) from custom post type?
- Do not add content filter on page template
- Create post using Ajax
- Usage of theme name in functions
- Dumping variable in custom pre_gets_post function in functions.php, returns NULL
- Function to update post_meta based on existing post_meta
- Load jquery only for certain pages in the backend
- How to load parent theme template parts in child theme
- allow only one post in specific category
- ACF not showing
- Cannot modify header information – headers already sent (wp_redirect in functions.php)
- Javascript function not working when placed in Text Block
- Custom styles.css sheet for visual editor
- Use html inside shortcode function
- How to remove comment count column in Posts inside the admin dashboard?
- Cannot declare function twice [closed]
- Publishing just a Facebook URL without full code snippet
- Filter an WordPress Function in (general-template.php)
- Unable to return values from function
- Function not working inside of a function in functions.php
- How to Use Global Variables Inside Header and Footer
- Show some menu sub items as dropdown under a menu item
- Set “woocommerce_is_purchasable” to false for specific “$product->is_stock_status”
- Redirect website domain (including all pages) to external URL after Popup message (few seconds)
- Where do I go to edit this area? [closed]
- How to remove some item from WordPress Dashboard for user Author
- processing form data with ajax
- Check from functions.php if function exists in footer.php
- Email Exists ERROR into Ajax registration form
- How to register a menu based on a ACF condition
- How to convert raw url to hyperlink?
- Split single-review.php to two parts
- Breaking up multiple words and inserting an image after first word
- get content from page through AJAX
- colorbox not loading in
- The work of WordPress Function update_post
- Facebook OpenGraph error, Call to undefined function wp_get_attachment_src()
- how can I change all wordpress media file url to custom cdn url?
- Changing the HTML of notices in WooCommerce [closed]
- Save_post – Warning: Cannot modify header information
- How to use WP conditional tag in a functions.php with OCEANWP Theme?
- How Can I Create a Friendly Slug for a Dynamic Page?
- custom error message for empty username and password using authenticate filter not working
- Modify content inside post before first publish
- Pass an argument into a function to extract from array
- function class doesnt work
- get_locale() is different from $locale
- how to remove a tag in the_category function
- Load CSS file conditionally
- my wordpress doesn’t save items to customized widget area
- Remove all video attachment, both files and post/postmeta from database?
- Copying a widget class to functions.php results on a blank page
- save_post doesn’t correctly process function call with php class
- No compression occurs on my jpegs after adding jpeg_quality hook to my functions.php file
- Changing the register url is not working
- Newest comments first not working
- Pass arguments to function class with do_action()
- How to a override parent theme page that has been included with require_once?
- Display most popular posts
- Can I use a function to return HTML and the result of another function?
- Dynamically generated Navigation Diagram using Custom Fields
- Excerpt length: get 2 paragraphs
- Remove heading tags on line break
- Function to get the name in database table from the comma separated string
- Full size image option removing problem
- Add custom fields after post/page title
- Ajax call does not work for this custom code
- Force resize for all video content
- Sort results by name & asc order on homepage
- Add the title of a widget as an ID – for anchor links
- I want to add the alt attribute to all the photos!
- Need to use an external variable inside a function
- Creating mixture of shortcodes to use in the visual/text editor
- Correct php syntax to add an image in wp functions.php
- Is storing in a variable the result of a fonction a most powerful way to code an if structures in WordPress?
- woocommerce_sort_product_tabs() expects an array