2016-01-12 35 views
5

headタグからwordpress feedのURLを削除/削除するにはheader.phpヘッダーのWordPressフィードURLを削除/削除する方法は?

例これらのURL:

<link rel="alternate" type="application/rss+xml" title="Example Business &raquo; Feed" href="http://example.com/feed/"/> 
<link rel="alternate" type="application/rss+xml" title="Example Business &raquo; Comments Feed" href="http://example.com/comments/feed/"/> 
<link rel="alternate" type="application/rss+xml" title="Example Business &raquo; Home Page Live Comments Feed" href="http://example.com/home/feed/"/> 

私は同じのための任意のプラグインを使用する必要はありません。

答えて

12

私は最近、フィードのURLリンク要素を削除し、コアをカスタマイズしないようにするために、ワードプレスの機能が次のように機能するようにしました。

ご使用のテーマディレクトリにfunctions.phpファイルがあることを確認してください。そうでない場合、ファイルを作成し、ファイルを編集します。次の行は、wp_head()関数からの選択行を削除するのに役立ちます。

<?php 
remove_action('wp_head', 'feed_links_extra', 3); // Display the links to the extra feeds such as category feeds 
remove_action('wp_head', 'feed_links', 2); // Display the links to the general feeds: Post and Comment Feed 
remove_action('wp_head', 'rsd_link'); // Display the link to the Really Simple Discovery service endpoint, EditURI link 
remove_action('wp_head', 'wlwmanifest_link'); // Display the link to the Windows Live Writer manifest file. 
remove_action('wp_head', 'index_rel_link'); // index link 
remove_action('wp_head', 'parent_post_rel_link', 10, 0); // prev link 
remove_action('wp_head', 'start_post_rel_link', 10, 0); // start link 
remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0); // Display relational links for the posts adjacent to the current post. 
remove_action('wp_head', 'wp_generator'); // Display the XHTML generator that is generated on the wp_head hook, WP version 
?> 
+1

これは非常にクリーンなソリューションです。しかし、自作テーマや子テーマを使用しないと、これらの変更は次のテーマ更新で上書きされることに注意してください。これを防ぐには、[子テーマ](https://codex.wordpress.org/Child_Themes)を作成するか、これから小さなプラグインを作成してください。 –

関連する問題