關閉WordPress的訂閱功能RSS Feed、移除網頁原始碼的超連結








※本篇內文資訊參考如下※



- -

※更新文章日期: 2017-09-14










關閉WordPress的訂閱功能FEED
移除網頁原始碼的超連結
開啟使用的佈景主題中的
functions.php 檔案

在檔案最後新增以下程式
新增完畢後清除快取

在去背景看就會不見囉!!
就算輸入原本網址
也會請使用者回去首頁
/** Disable WordPres Feeds **/
function wp_disable_feed() {
wp_die( ‘目前不提供 RSS 功能,請前往我們的
<a href=”‘. get_bloginfo(‘url’) .'” rel=”nofollow” >首頁</a>。’ );
}
add_action(‘do_feed’, ‘wp_disable_feed’, 1);
add_action(‘do_feed_rdf’, ‘wp_disable_feed’, 1);
add_action(‘do_feed_rss’, ‘wp_disable_feed’, 1);
add_action(‘do_feed_rss2’, ‘wp_disable_feed’, 1);
add_action(‘do_feed_atom’, ‘wp_disable_feed’, 1);
/** Disable WordPres  URL **/
remove_action( ‘wp_head’, ‘feed_links’, 2);
remove_action( ‘wp_head’, ‘feed_links_extra’, 3);








-

-