Return internal in-content links
Tue Dec 06 2022 23:43:12 GMT+0000 (UTC)
Saved by
@KeithS
/* Internal Links */
SELECT
targetpost.post_title AS TargetPost,
IF(
INSTR(yolinks.url, '#') > 0,
LEFT(
yolinks.url,
INSTR(yolinks.url, '#') -1
),
yolinks.url
) AS TargetURL,
sourcepost.post_title AS SourcePost,
CONCAT(
'https://pinchandswirl.com/',
sourcepost.post_name,
'/'
) AS SourceURL
FROM
wp_yoast_seo_links yolinks
INNER JOIN wp_posts sourcepost ON
yolinks.post_id = sourcepost.id
INNER JOIN wp_posts targetpost ON
yolinks.target_post_id = targetpost.id
WHERE sourcepost.post_type IN ('post', 'page')
and targetpost.post_type IN ('post', 'page')
GROUP BY
targetpost.post_title,
yolinks.url,
sourcepost.post_title,
sourcepost.post_name
content_copyCOPY
Comments