Can’t test at the moment but I’d try rewriting the date to variable code from:
$time = current_time( 'mysql' );
$y = substr( $time, 0, 4 );
$m = substr( $time, 5, 2 );
$subdirectory = "/$y/$m";
To:
$y = date('Y');
$m = date('m');
$subdirectory = "https://wordpress.stackexchange.com/" . $y . "https://wordpress.stackexchange.com/" . $m;
Related Posts:
- How to Protect Uploads, if User is not Logged In?
- WordPress Uploads Folder can’t be Written to
- Restricting access to files within a specific folder [duplicate]
- Failed media import
- Change WordPress’ media upload URL?
- 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 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
- Another “Sent Headers” Error w/ Missing Temporary Folder
- what happens to existing media files when I switch to year/month directory structure format?
- Decrease file size upload in Media
- WordPress Media Manager 3.5 – default link to
- Image upload callback in new 3.5 media
- How to wp_upload_bits() to a sub-folder?
- “Add Media” only shows “Full Size” under Attachment Display Settings
- Differentiate Featured Image from Post Images upon Upload
- Any plugin out there that uses WP’s internal image uploader?
- Is it possible to trigger some JavaScript when Media Popup is opened?
- There’s a way to scale media (images) at 50%?
- Failed to import media from a local wordpress site to a live one
- Media Uploader: get deleted files
- Rename “Add Media” Button To “Add Images”
- How to add a category or tag to media at upload time with the browser uploader?
- Alter media caption/description conflict in WordPress?
- How to create an edit media button for slideshow plugin?
- Post Specific Uploader
- WordPress Media mime type filter problem 4.0
- Image archive without date
- How to add a media with PHP
- Generated Images sizes do not match Media Settings Image Size
- Restrict file types in the uploader of a wp.media frame
- Media upload via backend doen’t work after moving site
- How to import 55k images (uploaded via FTP) into WordPress Media libary? [closed]
- Disable mouse image resizing in editor
- 3.5 Media Manager – callout in metaboxes
- How to restrict wp-admin and prevent upload errors
- How do I get allowed Media Library upload file extension list?
- Force WordPress, themes & plugins into using defined sizes
- Audio file’s length (duration) is missing from Attachment Details in Media Library [closed]
- Force documents to appear in Featured Image dialogue
- How to replicate Media Library “Add New” on Plugin Settings Page
- Change WordPress Media Manager
- Use the WP media uploader dialog for uploading a form attachment (non-admin). Offering progress and drag and drop feedback
- Video uploaded with the native media uploader gives Error 404
- Restrict media upload size by format
- WordPress automatically downscaled images larger that original
- adding images column to admin edit columns not working for SVG
- Link to resized media file
- WordPress Media Uploader in page template (On Front-end)
- WordPress media file link with fancybox
- making media URL secured
- WordPress media uploader – upload tabs not hiding
- Is it safe to allow non-admin users access to media uploader
- PHP error when trying to upload .mp3 files via Media Library [closed]
- Getting a specific value out of array using get_attached_media
- WordPress 3.6 native player is not responsive?
- Get images attached to a specific page
- Flat media folder vs multiple directories
- Move media files from the root to date folder structure
- Uploading a media item with the wp-json API to a specific path
- Can you limit the size of media files being uploaded not using php.ini?
- Send media uploads to different directories
- Open Media Uploader Link in single post or page
- Serving Images from subdomain in wordpress
- Using WP-CLI “wp media import” to sync files to the media library
- Use media files from a different server just for one custom type
- MIME type not supporting HEIC support type in WordPress
- How to manually set an attachment in a post?
- Adding attachment custom field metadata to TinyMCE tag
- Issue with upload.php with media
- Media files not loading
- TwentySeventeen $content_width not updated in admin
- media_handle_upload on mix form fields (not required file input)
- Zip all (original) images from media gallery
- wp_delete_attachment not working with multiple values
- Check if author or uploader id of the attachment(uploaded) image is match?
- Don’t show avatars in media library
- Insert media while posting is not working with new wordpress update
- wp_enqueue_media problem
- Elegant way to signify inheritance and relationship between posts
- Media Player gone on front end
- Why does uploading a media file a second time restore older version?
- add file name column to media library to sort by
- Media Gallery doesn’t show (using WP-Read Only)
- Cache of site on browser
- 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