Wordpress get plugin directory

前端 未结 14 981
广开言路
广开言路 2021-01-31 02:09

Is there any function that would return the full path of my plugin in WordPress?

Example is

path/wp-contents/plugins/myplugin

I have tr

14条回答
  •  自闭症患者
    2021-01-31 02:57

    My solution has been to use inside plugin_dir_path DIR

    plugin_dir_path( __DIR__ ) . $path_inside_plugin_folder;
    

    The above should give you the absolute path to your plugin folder on the server, then you can load your variable with any file within your plugin folder

提交回复
热议问题