2
對於我的生活,我不明白爲什麼WordPress不會運行此過濾器。我把它添加到我的Active子主題的functions.php中,存在的functions.phpYoast自定義站點地圖不工作Yoast 5.0
/* Add External Sitemap to Yoast Sitemap Index
* Credit: Paul https://wordpress.org/support/users/paulmighty/
* Last Tested: Oct 07 2016 using Yoast SEO 3.6 on WordPress 4.6.1
*/
add_filter('wpseo_sitemap_index', 'add_sitemap_custom_items');
function add_sitemap_custom_items(){
$sitemap_custom_items = '<sitemap>
<loc>http://www.website.com/external-sitemap.xml</loc>
<lastmod>2017-05-22T23:12:27+00:00</lastmod>
</sitemap>
<sitemap>
<loc>http://www.website.com/external-sitemap-2.xml</loc>
<lastmod>2017-05-22T23:12:27+00:00</lastmod>
</sitemap>
<sitemap>
<loc>http://www.website.com/external-sitemap-3.xml</loc>
<lastmod>2017-05-22T23:12:27+00:00</lastmod>
</sitemap>';
return $sitemap_custom_items;
}
NO其他代碼這是從這裏被複制:https://kb.yoast.com/kb/add-external-sitemap-to-index/
這是行不通的。我使用Yoast 5.0和WordPress 4.8
你沒有回答這個問題。 – Mauro
我在localhost中測試過它,它爲我工作,所以我不知道爲什麼你會投我的答案。 –
,因爲這個問題涉及Yoast SEO中的自定義站點地圖和本文https://kb.yoast.com/kb/add-external-sitemap-to-index/如果您建議的插件有效,您應該解釋爲什麼是示例在文章不起作用。請編輯答案,我會將它投票 – Mauro