WordPress终极优化指南–禁用RSS源
Warning: Undefined variable $output in /home/wwwroot/xiaoyuo.com/wp-content/themes/ripro-child/functions.php on line 68
本文共835个字,预计阅读时间需要3分钟 发布时间: 2024-10-4 共3.39K人阅读
WordPress终极优化指南–禁用RSS源
教程总目录:WordPress终极优化指南
RSS源主要也是用来订阅网站文章的,但是现在基本没人用,反而给采集文章的人带来了便利。所以说不想使用的可以直接禁止掉。
function itsme_disable_feed() { wp_die( __( 'No feed available, please visit the homepage!' ) );}add_action('do_feed', 'itsme_disable_feed', 1);add_action('do_feed_rdf', 'itsme_disable_feed', 1);add_action('do_feed_rss', 'itsme_disable_feed', 1);add_action('do_feed_rss2', 'itsme_disable_feed', 1);add_action('do_feed_atom', 'itsme_disable_feed', 1);add_action('do_feed_rss2_comments', 'itsme_disable_feed', 1);add_action('do_feed_atom_comments', 'itsme_disable_feed', 1);
写入functions.php即可
禁用后我们的每个页面还是有RSS地址的,所以我们把这个地址也删除
remove_action( 'wp_head', 'feed_links_extra', 3 );remove_action( 'wp_head', 'feed_links', 2 );
写入functions.php即可
下载仅供下载体验和测试学习,不得商用和正当使用。
常见问题FAQ
Warning: foreach() argument must be of type array|object, string given in /home/wwwroot/xiaoyuo.com/wp-content/themes/ripro-child/parts/author-box.php on line 12