The (database) option name for that setting is uploads_use_yearmonth_folders
, so you can use update_option()
to programmatically change the setting’s value:
// 1 to enable the "checked" state
update_option( 'uploads_use_yearmonth_folders', 1 );
You can also use a filter hook such as option_<name>
:
add_filter( 'option_uploads_use_yearmonth_folders', function ( $value ) {
return 1; // 1 = checked
} );
Or am I not understanding the question? 🙂
Related Posts:
- How to Protect Uploads, if User is not Logged In?
- Add media with WP-Rest-API v2
- Cleanup uploads folder, Media Library db structure
- Rendering the uploaded file in a wp.media object
- WordPress Media Manager 3.5 – default link to
- Linking a PDF as a downloadable document
- Failed to import media from a local wordpress site to a live one
- Is is possible to crop an image after uploading
- Rename “Add Media” Button To “Add Images”
- Image dimensions same as image size
- Filter what image sizes get generated
- Change default tab of media manager
- Is email post notify visitor on new media upload possible?
- How to set additional parameter in wp.media?
- get total number of images from media using xml-rpc
- Audio Playlist : How to bind events for “track change”, “track end”?
- How do I control video media display sizing with native wordpress player
- Failed media import
- Upload mobi and epub file in the MEDIA of WP
- Handle lots of images within the media uploader / selector
- Image archive without date
- FTP files directly to Media Library wp-content\uploads
- How to get an image url from media library
- Uploading Media gives error “Missing a temporary folder.”
- Disable mouse image resizing in editor
- Organizing media uploads
- How to insert an Audio Player in a Post or Page?
- Proper way to change the path of uploads folder for existing WordPress site
- 3.5 Media Manager – callout in metaboxes
- Front end wp_editor not rendering audio/video links
- Force WordPress, themes & plugins into using defined sizes
- Audio file’s length (duration) is missing from Attachment Details in Media Library [closed]
- Media Manager: refresh library after new selection
- WordPress Media Image Manager — Creating Lots and Lots of Odd Sized Images
- Large image size stuck on old value, even for new images
- Can I force all uploaded images to be reduced in quality?
- Cannot upload anything via wordpress
- Video uploaded with the native media uploader gives Error 404
- Rotating image does not work for custom image sizes
- Audio Player for MP3 Files for WordPress
- How select multiple document as like media gallery
- Rebuild the entire WordPress uploads folder
- See List View – or Image titles- of Media Library when “Add Media” button is used
- How to hide some specific attachments using post meta from media library
- adding images column to admin edit columns not working for SVG
- How to extend an existing (Gutenberg) block
- It is possible to add custom media size in admin media edit?
- Importing Media IDs but not related attachment
- Link to resized media file
- Allow Editor Role to Edit Media
- Bulk image importing from folders
- WordPress media file link with fancybox
- How to open a Media Uploader dialog with a particular image is selected
- Editing image dimension – to edit the main image file
- Force image crop size in media editor
- Set Maximum Width for an uploaded image
- Too slow Image upload in WordPress Media Library as image number increases
- Use staging media files on development site in WordPress
- Getting a specific value out of array using get_attached_media
- WordPress 3.6 native player is not responsive?
- Thumbnail images chopped off but not cropped to exact dimensions
- Uploading a media item with the wp-json API to a specific path
- Unable to add logo or header [closed]
- core/gallery get figcaption text
- How to disable (and hide) the Media Library for certain users?
- Import WordPress, Failed to import sizes
- Admin edit S3 Media file?
- Attaching images to multiple galleries
- Specific folder and no thumbnail generation for media_sideload_image
- Whats wrong with my wp gallery?
- How to re-house images in uploads/YYYY/MM
- Publish / unpublish media items in the media library
- Use media files from a different server just for one custom type
- Pre-load images into a new users media gallery
- How to get all id_attachment with one loop?
- Media isn’t showing in WordPress library but is available in uploads folder
- WP REST API Create media return Timeout Gateway in response, but media created
- Media Library not loading
- How do I get WordPress to create resizes of a supplied default image in a theme?
- Creating multiple instances of Media Uploader
- Handle image file and save it to media
- Multisite has SSL certificate, but media library is still http://
- TwentySeventeen $content_width not updated in admin
- Change behavior of the “ADD Media” buttom
- Disable wordpress gif compression?
- wordpress doesnt add media.css file
- Change default ‘file not supported’ error message
- How to create different media uploader frames / filter library depending on a custom action
- cant able to upload media to my wordpress blog
- Extra metadata for media items
- Change image in media library at specific time
- 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?
- Import of 200+ sermons
- add file name column to media library to sort by
- After import, oEmbeds non-functional until manual republish
- Cache of site on browser
- Add link to media files in backend and modify linked images in the frontend
- Looking for a way to insert PDF image preview in TinyMCE