skip to Main Content

I’m trying to get the path location of my wordpress plugin. I don’t mind if I have to get it via code or via checking the sources on my google devtools. I tried doing it via my sources on devtool but didn’t find it. I’m new to PHP and WP so I don’t know much how scoping works.

When I go to devtools I don’t see my plugins folder but the plugin is working and When I go to the admin console, I do see my plug in activated.

wordpress pluging

2

Answers


  1. Chrome dev – go to Sources and then expand the wp-content folder, and then the plugins folder.

    WordPress plugins are usually found at this path:
    https://your_domain.com/wp-content/plugins/the_plugin_folder

    Login or Signup to reply.
  2. Your chrome dev tools won’t mirror your local file structure. It’s showing folders where assets are being loaded from. If your plugin doesn’t load any CSS / JS, it won’t be listed.

    To get your plugin’s directory URL, add the following code:

    echo plugin_dir_url( __FILE__ );
    

    If you want the path instead, use:

    echo plugin_dir_path( __FILE__ );
    

    Either line must be used from within the plugin.

    Docs:
    https://developer.wordpress.org/reference/functions/plugin_dir_url/
    https://developer.wordpress.org/reference/functions/plugin_dir_path/

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