After digging around, I ended up with using upload_dir filter.
Here is what I tried in functions.php to change uploads to media. Hope it can help someone too 🙂
add_filter('upload_dir', function($uploads)
{
$custom = [];
foreach ($uploads as $key => $value) {
if ( false !== strpos($value, '/app/uploads') ) {
$custom[$key] = str_replace('/app/uploads', '/app/media', $value);
} else {
$custom[$key] = $value;
}
}
return $custom;
});
Many thanks to @gmazzap for the guidelines and the suggestion about upload_dir filter!
Related Posts:
- How to move wp-content (or uploads) outside of the WordPress directory
- Limit Media Library to Given Folder
- Automatically wrap post image in div
- media_handle_upload weird thing
- Looking to display non-image files in Gallery with logo specific to file type
- Creating a searchable A-Z listing of hundreds of companies/services
- Could not create directory. /var/www/html/wp-content/plugins/PLUGIN_NAME/
- Syncing Avatars across multisite
- How to re-arrange media uploaded using : media_handle_upload() as per year / month
- Hide upload image fields for the different media upload popups
- How to insert a sitemap within a subsite when using WordPress multisite
- How do you modify the WordPress directory structure?
- Add a InfoBox in the media upload window
- I’m using add_meta_box() but want to include TinyMCE editor *and* Media Uploads for each box
- Integrate wordpress into index page
- WordPress media uploader – upload tabs not hiding
- custom upload directory only for plugin uploads
- problem in uploading attachment to custom directory
- Installing new theme on running site
- How can I stop access of unregistered user in wp-content/uploads directory without using .htaccess file?
- Media Upload not working after hiding some elements from functions.php
- WordPress in a Subdirectory
- How to setup a membership system in WordPress?
- Personalized Gallery what are my options?
- Can’t upload format files on media library
- the temporary save folder is wrong
- Can’t do a src to node modules folder
- Problems with running a 2nd installation of WordPress on my domain?
- Hosing a website within a WordPress directory/folder
- Altered Media Library URLs
- How do I enable the text editer in my WordPress theme? [closed]
- Creating a Treeview Listing of a Directory
- Is there a way to limit multi upload in media upload box?
- Having a forum in a subfolder
- Custom Link In WordPress Media “Attachment Details” Upload Screen
- How can I add a Description column to the media library browser screen?
- Upload files in wordpress
- Custom image sizes ignored in WP 3.5
- WordPress uploads directory. Featured Images storage
- Custom Role with Own Page Edit Capability
- List top 5 authors with most posts
- Looking replicate static HTML Menu into WordPress Dynamic Menu [closed]
- CSS Styling a specific page
- How to remove footer from just homepage
- How can I start over on my site? [closed]
- Plugin to allow registered users to customize their layout [closed]
- Can Username and Password be passed to WP Login page in an IFrame?
- Returning or use form data using a hook?
- Custom Columns WordPress Admin
- If custom image header does not exist display text header
- Get users based on month ACF datepicker field
- Trigger Customizer Publish (save) Action
- Edit value=”” of a button in child theme
- External Link Button Under Post Excerpt on Index.php
- Creating php pages in wordpress and assigning them to wordpress pages
- Showing different pages depending on a cookie value
- WP function duplicating body content
- Custom blog setting directs blog to index page
- Custom section (e.g. Demos or Downloads)
- WooCommer Product Category Loop – How to change the display order of the rating and price?
- How to Remove the Custom Theme Panel from a Theme?
- Replace TimThumb in existing WordPress Themes
- Moved wp-content and got problem with themes directory?
- title tag function
- How to do multi site setup
- WordPress search on a custom table
- How to get the full product name by ignoring custom modification on it
- Is it possible to edit a wordpress category with Gutenberg?
- How to change Login default blue admin color?
- How do i remove this from logged in users?
- Schedule a subscription on gravity form, stripe add-on
- Twenty Twenty edit “Read more” text
- Some questions about best practices for custom code
- I want to change url structure of my created archieve pages
- Simple Add To Cart Ajax Button
- How to prepend block content in getSaveElement filter?
- Upload advanced custom field text link array with csv
- Advice on how to structure a custom plugin
- How can I delete the word `Category:` from page titles? [duplicate]
- How can I add category variable inside posts?
- Create page when a new site in multisite network is created?
- Figuring out how to create “Option Pages” in WordPress admin
- Including a Customized Initialize File with a wordpress header
- Link to a new page into a plugin
- How do I display custom RSS fields on my site?
- How do I change the content of an element for a theme without losing the styling?
- Change the – WordPress from titlebar?
- I can’t override CSS
- How to Remove wpautop in woocommerce includes folder class-wc-order-item.php
- How to replace specific word in wordpress without losing their functionality
- Url rewriting on custom post with CPT UI plugin
- WordPress custom search – pagination
- Add field to post form
- Custom page template in warp7 (Yootheme template)
- Create dashboard setting which lets me set ID of category which is inserted into template
- Setting variables as custom field values
- How to restore deleted wordpress site?
- Which IDE best for WordPress Development? [closed]
- How do I fix the url when clicking on portfolio item?
- customizing a theme [closed]