Skip to content

Instantly share code, notes, and snippets.

@cybersholt
Created September 22, 2022 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cybersholt/91228925dc34f4dd6f8307b6055c5c58 to your computer and use it in GitHub Desktop.
Save cybersholt/91228925dc34f4dd6f8307b6055c5c58 to your computer and use it in GitHub Desktop.
Export Yoast Keywords
SELECT wpp.post_title, wpp.ID, wpp.post_date, mt1.meta_value as focus_keyword,
REPLACE( REPLACE( REPLACE( REPLACE( wpo.option_value, '%year%', DATE_FORMAT(wpp.post_date,'%Y') ), '%monthnum%', DATE_FORMAT(wpp.post_date, '%m') ), '%day%', DATE_FORMAT(wpp.post_date, '%d') ), '%postname%', wpp.post_name ) AS permalink
FROM wp_posts wpp
LEFT JOIN wp_postmeta AS mt1 ON (wpp.ID = mt1.post_id AND mt1.meta_key='_yoast_wpseo_focuskw')
JOIN wp_options wpo
ON wpo.option_name = 'permalink_structure'
WHERE wpp.post_type = 'post'
AND wpp.post_status = 'publish'
ORDER BY wpp.post_date DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment