In my functions.php, I have a need to list all images in the uploads folder which are not currently attached to a post in the WP database.
It appears that every time an image is uploaded to the WP uploads folder (via FTP or via Media Manager), a records gets inserted in the WP database, right?
How can I obtain a list of all images that are not currently attached to any post?
This should work:
If you need that in your UI to manage those:
/wp-admin/upload.php?detached=1
Add the address to your blog in front.
Or more descriptive:
Log into your admin then use the menu: Media -> Library. Select the Unattached link above the lists’ filter drop-down.