Wordpress:列出具有特定URL的所有页面/帖子

问题描述 投票:-1回答:2

是否有一个php脚本或wordpress插件,我可以在其中键入特定的url并获取其内容中包含该url的所有页面或帖子的列表作为链接?

php wordpress
2个回答
0
投票

获取所有帖子,然后过滤其内容中包含您要查找的链接的帖子。

$all_posts = get_posts(['numberposts'=>-1]);
$posts = array_filter($all_posts, function($post) {
   return strpos('https://example.com/', $post->post_content) !== FALSE;
});

0
投票

您可以通过XML网站地图获得此信息。您可以使用YoastGoogle XML Sitemaps插件。您可以使用Page-list创建页面列表,并使用Ultimate Post List插件创建帖子列表。

© www.soinside.com 2019 - 2024. All rights reserved.