If you define a custom folder in your wp-config.php, be sure to add the definition before the last line of the file.
Stefano.
Okay I did a little more testing.
In my wp-config.php I have
define(‘INCLUDE_ME_DIR’, WP_CONTENT_DIR . ‘/mypath/custom-include’);
as the last line ( I do have a blank line as the actual last line in the file.)
if I edit your plugin.php file like this:
if (!defined(‘INCLUDE_ME_DIR’)) {
// define(‘INCLUDE_ME_DIR’, WP_CONTENT_DIR . ‘/include-me’);
}
Then the plugin works. However …
If I leave the above section uncommented, then the php constant INCLUDE_ME_DIR is OVERWRITTEN! This is not supposed to be possible.
I am using Apache2 on Ubuntu 18.04 with PHP8
-
This reply was modified 4 years, 7 months ago by
coreigh.
Hi WP_CONTENT_DIR cannot be used inside wp-config.php, it is defined later. You can try with
define(‘INCLUDE_ME_DIR’, __DIR__ . ‘/wp-content/…..’);
Okay,
If I create a folder /wp-content/include-me, and place all my includes in the folder the plugin works. The include-me folder can not be a sym link, and the files inside include-me can not be sym links.
OR
If I modify plugin.php and hard code my path in the define() function the plugin works.
OR
If I define the constant in the wp-config.php using the __DIR__ constant (as you suggest above) AND modify the plugin.php file to NOT check for ‘INCLUDE_ME_DIR’, then the plugin works.
So my testing says that the plugin does not work with a custom path unless I modify plugin.php
It still appears to me that the plugin.php overwrites the INCLUDE_ME_DIR constant.
Please, check you define in wp-config.php e be sure to rewrite it and not copy and paste it: could be you copied the ‘ from the web and they’re not really single quotes.