php - 如何删除/删除标题中的 WordPress feed url?

标签 php wordpress

如何从 header.php 中的 head 标记中删除/移除 wordpress feed 网址?

以下 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/"/>

我不想使用任何插件。

最佳答案

我最近需要删除 feed url 链接元素,并试图避免自定义核心 WordPress 功能,以下解决方案有效。

确保您正在使用的主题目录中有一个 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
?>

关于php - 如何删除/删除标题中的 WordPress feed url?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34750148/

相关文章:

php - 如何准备 mysql 查询以在 smarty 部分循环?

php - 从表中获取 $_POST 变量

php - PHP 和 SQL 中日期的转换

php - MySQL多表连接

php - WordPress get_posts() 比较meta_query 中的时间戳问题

php - 使用 wp_enqueue_style() 导入样式表 - wordpress 不工作

php - 如何在多个 apache 服务器上管理单个 PHP5 session ?

html - 在wordpress上更改代码字体大小

php - 如何在 WordPress 中使用 ajax 加载 facebook 评论

javascript - JS 书签问题 : Code works in console, 在书签中失败