【问题标题】:Add Wordpress Pages to their own RSS feed and not main RSS feed using Plugin使用插件将 Wordpress 页面添加到他们自己的 RSS 提要,而不是主 RSS 提要
【发布时间】:2018-11-14 01:05:36
【问题描述】:
【问题讨论】:
标签:
wordpress
plugins
rss
【解决方案1】:
`我找到了解决方案。
add_action( 'pre_get_posts', 't5_pages_in_feed' );
/**
* Set post type to 'page' if it was requested.
*
* @param object $query
* @return void
*/
function t5_pages_in_feed( &$query )
{
if ( isset ( $_GET['post_type'] ) && $_GET['post_type'] === 'page' && is_feed() )
{
$query->set( 'post_type', 'page' );
}
}`
现在您在 /feed/?post_type=page 处获得页面提要。
https://wordpress.stackexchange.com/questions/52853/how-to-get-a-feed-for-post-type-page