Skip to content

Instantly share code, notes, and snippets.

@jdevalk
Created December 17, 2013 16:11
Show Gist options
  • Save jdevalk/05d6b0c3e74b4527e3a7 to your computer and use it in GitHub Desktop.
Save jdevalk/05d6b0c3e74b4527e3a7 to your computer and use it in GitHub Desktop.
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_meta-robots' AND meta_value = 'index,follow';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_meta-robots-noindex' AND meta_value = '0';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_meta-robots-nofollow' AND meta_value = '0';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_meta-robots-adv' AND meta_value = 'none';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_meta-robots-adv' AND meta_value = '';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_sitemap-prio' AND meta_value = '-';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_sitemap-include' AND meta_value = '-';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_opengraph-description' AND meta_value = '';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_google-plus-description' AND meta_value = '';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_title' AND meta_value = '';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_metadesc' AND meta_value = '';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_metakeywords' AND meta_value = '';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_focuskw' AND meta_value = '';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_bctitle' AND meta_value = '';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_canonical' AND meta_value = '';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_redirect' AND meta_value = '';
DELETE FROM wp_postmeta WHERE meta_key = '_wpseo_video_meta' AND meta_value = '';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_video_meta' AND meta_value = 'none';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_linkdex' AND meta_value = '0';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_newssitemap-original' AND meta_value = '';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_newssitemap-stocktickers' AND meta_value = '';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_sitemap-html-include' AND meta_value = '-';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_opengraph-image' AND meta_value = '';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_videositemap-tags' AND meta_value = '';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_videositemap-category' AND meta_value = '';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_videositemap-rating' AND meta_value = '';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_videositemap-thumbnail' AND meta_value = '';
@archon810
Copy link

If you want to see what the value are first as well as how many there are, before deleting them:

SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_meta-robots' AND meta_value = 'index,follow'
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_meta-robots-noindex' AND meta_value = '0'
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_meta-robots-nofollow' AND meta_value = '0'
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_meta-robots-adv' AND meta_value = 'none'
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_meta-robots-adv' AND meta_value = ''
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_sitemap-prio' AND meta_value = '-'
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_sitemap-include' AND meta_value = '-'
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_opengraph-description' AND meta_value = ''
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_google-plus-description' AND meta_value = ''
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_title' AND meta_value = ''
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_metadesc' AND meta_value = ''
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_metakeywords' AND meta_value = ''
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_focuskw' AND meta_value = ''
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_bctitle' AND meta_value = ''
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_canonical' AND meta_value = ''
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_redirect' AND meta_value = ''
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_wpseo_video_meta' AND meta_value = ''
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_video_meta' AND meta_value = 'none'
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_linkdex' AND meta_value = '0'
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_newssitemap-original' AND meta_value = ''
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_newssitemap-stocktickers' AND meta_value = ''
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_sitemap-html-include' AND meta_value = '-'
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_opengraph-image' AND meta_value = ''
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_videositemap-tags' AND meta_value = ''
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_videositemap-category' AND meta_value = ''
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_videositemap-rating' AND meta_value = ''
UNION
SELECT * FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_videositemap-thumbnail' AND meta_value = ''

@osaunier
Copy link

Hi,
That's what I need but using it, it crash my WPML plugin, maybe there's an updated script?
Thanks

@manuluyten
Copy link

Is it safe to delete all the _yoast_wpseo_metakeywords records, now that this feature is no longer supported?
Even when the value is not empty?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment