Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom plugins, uploads & themes directories #759

Open
ahmu83 opened this issue Feb 3, 2025 · 1 comment
Open

Custom plugins, uploads & themes directories #759

ahmu83 opened this issue Feb 3, 2025 · 1 comment

Comments

@ahmu83
Copy link

ahmu83 commented Feb 3, 2025

Summary

I tried setting up custom plugins, uploads & themes directory but I am not getting the expected output. In my ./config/application.php I added this:

// Define theme directory and URL if THEMES_DIR is set in .env
if (env('THEMES_DIR')) {
    Config::define('WP_THEME_DIR', $webroot_dir . '/app/' . env('THEMES_DIR'));
    Config::define('WP_THEME_URL', Config::get('WP_HOME') . '/app/' . env('THEMES_DIR'));
}

// Define plugin directory and URL if PLUGINS_DIR is set in .env
if (env('PLUGINS_DIR')) {
    Config::define('WP_PLUGIN_DIR', $webroot_dir . '/app/' . env('PLUGINS_DIR'));
    Config::define('WP_PLUGIN_URL', Config::get('WP_HOME') . '/app/' . env('PLUGINS_DIR'));
}

// Define uploads directory if UPLOADS_DIR is set in .env
if (env('UPLOADS_DIR')) {
    Config::define('UPLOADS', 'app/' . env('UPLOADS_DIR'));
}

And in my ./.env I added these values:

# custom directories for plugins, themes & uploads
THEMES_DIR='static/theme'
PLUGINS_DIR='static/addon'
UPLOADS_DIR='static/media'

When I upload a file in wp-admin it adds wp to the url http://site.test/wp/app/static/media/2025/02/img.png instead http://site.test/app/static/media/2025/02/img.png

Additional context

No response

@MeonValleyWeb
Copy link

MeonValleyWeb commented Feb 12, 2025

Are you missing a '/' in app/?

Config::define('UPLOADS', 'app/' . env('UPLOADS_DIR'));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants