Plugin_Dir_Url( __File__ ) Not Working in My Wordpress Plugin Development

Plugin_Dir_Url( __File__ ) Not Working in My Wordpress Plugin Development

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


But I want to access to After using the function it includes with

admin

folder. not the base plugin base url Thanks

2 Answers

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

1

Thanks Finally I got a solution by using

plugin_dir_url(dirname(FILE))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Elena Rostova
Author

Elena Rostova

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.