Skip to content

Custom plugins, uploads & themes directories #759

Closed as not planned
Closed as not planned
@ahmu83

Description

@ahmu83

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions