Recently, I have noticed this scenario, where my images uploading to media library, saving on to older years, months not the current year. Is it possible to make image uploading to current, I am not uploading images inside any post/pages, I am directly uploading to media library. Please help me, it cant be an issue, but enhancement can be done, I think


You should check yourself what you get when you execute wp_upload_dir. Typically you run this code:

$d = wp_upload_dir();
print_r( $d );

And the reply needs to be like this in 2017/01

    [path] => /var/www/html/test100.com/wp-content/uploads/2017/01
    [url] => http://test100.com/wp-content/uploads/2017/01
    [subdir] => /2017/01
    [basedir] => /var/www/html/test100.com/wp-content/uploads
    [baseurl] => http://test100.com/wp-content/uploads
    [error] => 

You will soon find out if this function creates the problem. Also as usually try to disable all the plugins and test then. This way you will get the feedback if some code from your plugins makes the problem.

Other several things may be

get_option( 'upload_path' )
get_option( 'uploads_use_yearmonth_folders' )
current_time( 'mysql' ) if your server has broken date time from some reason.

You can check the current_time with this code:

$t = current_time( 'mysql' );
print_r( $t );

Just let me know if you need anything.

  • Thanks @prosti!!! I will anaylse the problem using your techniques – Thiyagesh Jan 13 '17 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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