0

How can I programmatically change this setting? admin settings page

1 Answer 1

1

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? :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.