skip to Main Content

This is my plugin directory access when I use plugin_dir_url(__FILE__)

http://127.0.0.1/WordPressProject/myplugin/wp-content/plugins/advanced-plugin/admin/

But I want to access to http://127.0.0.1/WordPressProject/myplugin/wp-content/plugins/advanced-plugin/
After using the function it includes with

admin

folder. not the base plugin base url
Thanks

2

Answers


  1. Chosen as BEST ANSWER

    Thanks Finally I got a solution by using

    plugin_dir_url(dirname(FILE))


  2. Use plugin_dir_url( __FILE__ ); for the URL and plugin_dir_path( __FILE__ ); for the path.

    Pass the plugin’s main file to both functions to get similar results.

    plugins_url( string $path = '', string $plugin = '' )
    

    Retrieves a URL within the plugins or mu-plugins directory.

    For more information

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search