I hvae a plugin which includes php file from another plugin.
So I would do this:
plugin 'foo' includes file from plugin 'blah':
wp-content/plugins/foo
include(__DIR__."/../blah/some-file.php");
This works but I am sure if I like this ../ , I wanted to reference plugin directory like:
include( WP_PLUGIN_DIR.'/blah/some-file.php' );
This works as well, but it say here:
WordPress makes use of the following constants when determining the path to the content and plugin directories. These should not be used directly by plugins or themes, but are listed here for completeness.
https://codex.wordpress.org/Determining_Plugin_and_Content_Directories
I cannot use plugin_dir_url() without an argument, like:
include( plugin_dir_url().'/blah/some-file.php' );
I can only do this:
include( plugin_dir_url(__FILE__).'/../blah/some-file.php' );
which is the same as first include above with DIR
__DIR__
can be used in this case. but do you really need that ? you will have an error if you deactivate the plugin with the included file. I recommend to use communication between plugins like that : wordpress.stackexchange.com/questions/426353/…