• Resolved squarestar

    (@squarestar)


    I have renamed the wp-content directory using define( 'WP_CONTENT_DIR', [string] ) and define( 'WP_CONTENT_URL', [string]) but the settings page is giving an error saying it can’t find or write to the wp-content directory.

    I know the plugin has filters for advanced usage, but I have already defined the correct locations in the wp-config.php file, which should be the canonical way for the plugin to determine the correct path for its own requirements.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Hello @squarestar,

    Thanks for your message.

    Unfortunately, the plugin cannot detect this automatically, as it would be incompatible for other plugin users.

    Please see the plugin FAQ and use the filters to change the directory path.

    Best,
    Mateusz

    Thread Starter squarestar

    (@squarestar)

    Thanks for your reply. I have added the filters that fix the problem for me.

    The only thing I would say is this: My solution is below, and you can see that I am not providing any information that is specific to my installation. I’m not really clear why the plugin can’t use this information by default and still allow other users to supersede it.

    The priority feature of filters should mean that the plugin itself could use a priority of say 5, and any customisation would just need to use a later priority.

    
    function filterWebpcDirPath($path, $directory)
    {
    	if ($directory === 'uploads') {
    		return WP_CONTENT_DIR . '/uploads';
    	}
    
    	if ($directory === 'webp') {
    		return WP_CONTENT_DIR . '/uploads-webpc';
    	}
    
    	return $path;
    }
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Plugin does not detect change in wp-content directory’ is closed to new replies.