How to get path or root of plugin folder, not file or dir?
How about just define a constant that stores the plugin’s root path? Define path constant For calling numerous files, it is sometimes convenient to define a constant: define( ‘MY_PLUGIN_PATH’, plugin_dir_path( __FILE__ ) ); include( MY_PLUGIN_PATH . ‘includes/admin-page.php’); include( MY_PLUGIN_PATH . ‘includes/classes.php’); // etc. — See https://developer.wordpress.org/reference/functions/plugin_dir_path/#comment-491 So in your main plugin file: define( ‘MY_PLUGIN_PATH’, plugin_dir_path( … Read more