uploads - WordPress suddenly starts uploading media to an old (backdated) folder

I've seen a couple of people ask about this but without a general conclusion.It worked until recently, but recently

I've seen a couple of people ask about this but without a general conclusion.

It worked until recently, but recently all media uploads from the media upload tool end up in an old folder, 2019/10, instead of the one for the current month.

BUT when uploading from a new post, the media goes into the correct folder, for the current month.

So there's different behaviour between uploading from the media upload tool (the stock one), and when uploading from the post editor (the new / Gutenberg one, for blocks).

Any ideas where to start digging?

I've seen a couple of people ask about this but without a general conclusion.

It worked until recently, but recently all media uploads from the media upload tool end up in an old folder, 2019/10, instead of the one for the current month.

BUT when uploading from a new post, the media goes into the correct folder, for the current month.

So there's different behaviour between uploading from the media upload tool (the stock one), and when uploading from the post editor (the new / Gutenberg one, for blocks).

Any ideas where to start digging?

Share Improve this question asked Feb 4, 2020 at 23:27 Ivan VorasIvan Voras 1413 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 2

In case anyone encounters this in the future: after drilling down into the WP source and the database, it turns out that when media files are uploaded, WP still needs to attach them to some post, and for some reason, even though the post_id is 0 in the fuction which processes media uploads, it managed to find an entry in the wp_posts table and use that to attach media files to. After that, the mechanism which determins the path to save the media file based on the post it's attached to kicks in, so the file is saved in the folder of the post entry.

I solved this by deleting the entry in the wp_posts table, after which WP stopped attaching media uploads to post entries, and storing them in the folder structure based on the date of the upload (i.e. the current date).

This took instrumenting the WP source and drilling down into what happens in the database. Definitely seems like a bug, and definitely not solvable in a user-friendly way.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744774103a4592940.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信