I am using WordPress with Nextgen Gallery by Alex Rabe for quite sometime. Once upon a time I had a good amount galleries in my website which were used in many posts through nextgen gallery shortcode. But for quality enhancement I have deleted many posts but the galleries related to those posts remain there in file system as orphan. How to find the galleries not used in post database?
Table added by nextgen gallery:
Column Type Null Default Comments gid bigint(20) No name varchar(255) No slug varchar(255) No path mediumtext Yes NULL title mediumtext Yes NULL galdesc mediumtext Yes NULL pageid bigint(20) Yes 0 previewpic bigint(20) Yes 0 author bigint(20)
wp_posts (Wordpress default table)
Column Type Null Default Comments ID bigint(20) No post_author bigint(20) No 0 post_date datetime No 0000-00-00 00:00:00 post_date_gmt datetime No 0000-00-00 00:00:00 post_content longtext No
gid is the gallery id. for an example if the gid is 8 i use the nextgen gallery shortcode [nggallery id=8] in the post and it is saved in the post_content field of wp_posts table. i want to know the gid's which are not present in any post_content of whole wp_posts table.