SELECT COUNT ( `P` . `ID` ) FROM `wp_posts` AS `P` LEFT JOIN `wp_yoast_indexable` AS `I` ON `P` . `ID` = `I` . `object_id` AND `I` . `link_count` IS NOT NULL AND `I` . `object_type` = ? LEFT JOIN `wp_yoast_seo_links` AS `L` ON `L` . `post_id` = `P` . `ID` AND `L` . `target_indexable_id` IS NULL AND `L` . `type` = ? AND `L` . `target_post_id` IS NOT NULL AND `L` . `target_post_id` != ? WHERE ( `I` . `object_id` IS NULL OR `L` . `post_id` IS NOT NULL ) AND `P` . `post_status` = ? AND `P` . `post_type` IN (...) 