希望删除<dc:creator>或将其编辑为静态值,而不编辑核心Wordpress文件。最好是作为一个功能。
发布于 2012-09-11 02:03:53
/wp-includes/feed-rss2.php复制到主题文件夹dc:creator的行)functions.php文件中,添加以下函数:remove_all_actions( 'do_feed_rss2' );
function create_my_custom_feed() {
load_template( TEMPLATEPATH . '/feed-rss2.php');
}
add_action('do_feed_rss2', 'create_my_custom_feed', 10, 1);Otto编辑:虽然这会起作用,但这将是一个更好的方法:
function create_my_custom_feed() {
load_template( TEMPLATEPATH . '/feed-rss2.php');
}
add_feed('rss2', 'create_my_custom_feed');add_feed()函数是智能的,它将为您处理操作等。
注意:它需要一次性使用flush_rules()才能生效.
发布于 2018-10-01 19:17:03
对于那些不想做PHP脚本黑客的人来说。该字段只显示文章的作者名称。如果您想要更改它的内容,请转到WP管理员,然后转到‘->’您的配置文件‘(或者转到您想要更改的特定用户那里)。然后将字段“Display”更改为要在RSS提要中显示的内容。
发布于 2012-04-02 20:24:46
不幸的是,该元素被硬编码到WordPress核心中。看看/wp-includes/feed-rss2.php:
<item>
<title><?php the_title_rss() ?></title>
<link><?php the_permalink_rss() ?></link>
<comments><?php comments_link_feed(); ?></comments>
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
<dc:creator><?php the_author() ?></dc:creator>
<?php the_category_rss('rss2') ?>
<guid isPermaLink="false"><?php the_guid(); ?></guid>
<?php if (get_option('rss_use_excerpt')) : ?>
<description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
<?php else : ?>
<description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
<?php if ( strlen( $post->post_content ) > 0 ) : ?>
<content:encoded><![CDATA[<?php the_content_feed('rss2') ?>]]></content:encoded>
<?php else : ?>
<content:encoded><![CDATA[<?php the_excerpt_rss() ?>]]></content:encoded>
<?php endif; ?>
<?php endif; ?>
<wfw:commentRss><?php echo esc_url( get_post_comments_feed_link(null, 'rss2') ); ?></wfw:commentRss>
<slash:comments><?php echo get_comments_number(); ?></slash:comments>
<?php rss_enclosure(); ?>
<?php do_action('rss2_item'); ?>
</item>https://wordpress.stackexchange.com/questions/47726
复制相似问题