Creating duplicate unattached image records in DB
-
I recently noticed that FAF was generating an enormous number of unattached media files, so I did a bit of research and I think I may have uncovered a bug (or at least something annoying).
When an Image Filter is added on the Posts & Links page and “Save images locally” is marked, a duplicate, unattached record is created in the database.
Effect: database clutter – the “unattached” records remain when a post and its media are deleted. May also mean WP doesn’t delete the media files when the posts are removed? (Not sure about that.)
Here’s how I tested:
Deleted a few posts, emptied trash.
Unmarked the “Save images locally” option.
Ran feed updates manually.Result: local copies of images are created for new posts in the normal way and are attached to the correct post_parent.
Deleted a few posts, emptied trash.
Marked the “Save images locally” option.
Ran feed updates manually.Result: local copies are created as before, but a second media (attachment) record is also created in the DB. It is exactly the same as the first, pointing to the same image, but has post_parent set to 0.
I tried it with the “Set featured image” option as well, but that doesn’t seem to affect it. It’s definitely the “Save images locally” option that’s duplicating lines.
Hope it helps. 🙂
- The topic ‘Creating duplicate unattached image records in DB’ is closed to new replies.