It was actually easier than I thought.
function route_uploads_past_cdn( $url, $path ) {
$upload_paths = array( 'async-upload.php', 'media-new.php' );
if( !in_array( $path, $upload_paths ) ) {
return $url;
}
return str_replace('www.', '', $url);
}
add_filter( 'admin_url', 'pew_route_uploads_past_cdn', 10, 2 );
The URL for uploading media would normally be http://www.example.com/wp-admin/media-new.php
would now be http://example.com/wp-admin/media-new.php
since the URLs are passed through admin_url()
which you can filter.
Related Posts:
- How to Protect Uploads, if User is not Logged In?
- WordPress Uploads Folder can’t be Written to
- Best image hosting service
- Restricting access to files within a specific folder [duplicate]
- Failed media import
- Disable drag and upload in Media Library
- Organizing media uploads
- Moving existing media items to new upload path structure not updating full URL path
- Proper way to change the path of uploads folder for existing WordPress site
- Cannot upload anything via wordpress
- Rotating image does not work for custom image sizes
- Limit number of images to upload in wp.media function
- WordPress media upload automatic refresh
- Upload video in custom folder
- Set Maximum Width for an uploaded image
- Too slow Image upload in WordPress Media Library as image number increases
- Whats wrong with my wp gallery?
- How to change Route respond To A specific Path?
- How to Protect Uploads, if User is not Logged In?
- Handle image file and save it to media
- cant able to upload media to my wordpress blog
- Customize WordPress Upload Directory
- Another “Sent Headers” Error w/ Missing Temporary Folder
- I am facing problem in loading and downloading Mp3 files
- For what security reasons are svgs blocked in the media uploader?
- “Add Media” button in custom plugin
- Media library to list images only user uploaded
- Which filters or actions to use after a media upload and delete?
- Proper way to add a button to the top menu of the media library?
- Filter for changing MediaElement.js Settings
- Protecting direct access to PDF and ZIP unless user logged in (without plugin)
- Media Upload Folder – how to manage
- How to hide media uploads by other users in the Media menu?
- Multisite, upload images directly to Amazon S3
- Attach Files Metabox
- Force wordpress to see uploads folder media
- Extend 3.5 media uploader plugin to change button name
- Disable TinyMCE Drag and Drop
- WP3.5 Media Uploader – how to make it accept multiple images?
- Upload images with comment
- Setting wp_temp_dir and permissions not working for “Missing A Temporary Folder” error
- Upload images and attachments from frontend form
- Add media with WP-Rest-API v2 II
- Maximum upload size changes in php.ini ignored – How to remove upload size limit?
- Media library storing files in uploads not folders within in uploads
- Can’t edit media details in new role
- add_image_size landscape or portrait
- What table is the media’s sort order stored?
- How to delete uploads not in media library?
- Why does SVG upload in Media Library fail if the file does not have an XML tag at the beginning?
- media_handle_upload : undefined function?
- How to limit characters of the post title?
- Site icons with alpha channel for self-hosted WordPress blog network
- Trigger JS in custom meta box if a featured image is loaded/exists
- HTTP Error when uploading files above 7mb unless using GD Image Editor
- Deleting images from gallery remain as attachment
- Cannot embed YouTube videos “Failed to embed” error
- Create a new post using rest api and save featured image using an external image url
- wp_get_attachment_image_src() returns wrong url
- How to upload media to a specific folder without a plugin in WordPress?
- Password Protecting Media
- Can I Change the Media Upload Location for each user?
- Media library only shows for admin. Doesn’t show editor or below [closed]
- Upload featured image from front end using media-upload.php
- Change media URL (images)
- Capability to prevent upload of files
- Importing 10 Years of Media into the WP Database
- WordPress Automatic Filename Changer
- How to add meta box for image upload using WordPress media uploader?
- A link (not in the post) to download a specific PDF file
- wp.media issue with selected image
- Custom upload folder
- Woocommerce blank screen variable product attribute image thumbnail
- Missing a temporary folder not fixed
- Adding Files to Page Only Adds Title, Doesn’t Create Link
- Deleting media using the WordPress Rest API
- Images missing from the media folder
- Is There A Way To Auto-Stock Media Files To Every Site On A WordPress Network?
- wp_delete_attachment doesn’t delete image files / doesn’t work
- Direct media library upload saving in wrong month date folder in custom theme
- Is there some way to find if media items are used anywhere on the site?
- Media URL slugs without uploads folder path
- Frontend media shows “An error occurred in the upload. Please try again later.”
- Showing added mime types in REST media response
- How to resize image in wordpress from backend? Seems like bug in wordpress
- Gifs displaying soft?
- WP_Custom_Media_Control | Give ID to media file
- WP Add Media Button – Can I set the default size to Original/Full Size
- Theme stops media uploader from working
- How to split my uploaded media into directories?
- Categories in media library
- All files unattached in Media Library
- Missing Images in Uploads Directory (Server Only)
- WordPress media upload multiple images
- WordPress / Audio player
- Pictures won’t display in media library and also won’t show preview when selected
- Using WordPress.com API to retrieve featured images
- Inserting Media on New Post But Hides Previous Uploads for Editor/Contributor
- Updating Media Library PDF’s in bulk
- upload image to wordpress media library failed for custom post type