【发布时间】:2016-02-16 10:23:27
【问题描述】:
所以我可以将某个类别的帖子排除在 WordPress RSS(等)提要中显示,我的问题是我还需要阻止 cmets 显示这些帖子。
但是转到 http://www.example.com/comments/feed/ 会显示这些帖子的 cmets,这些帖子应该保持私密。
高低搜索,各种尝试,望高手帮忙!
【问题讨论】:
-
修复了自己,改用评论父帖子的帖子类型来排除,但你可以做你想做的事,如下所示。 xxx 和 yyy 显然是虚拟值! >function custom_comment_feed_where($where) { >global $wpdb; >// 获取帖子类型 >$where .= " AND $wpdb->posts.post_type NOT IN ( >'xxx', >'yyy' >)"; >返回$哪里; >} >add_filter('comment_feed_where', 'custom_comment_feed_where');`
-
[code]function custom_comment_feed_where($where) { global $wpdb; // 获取帖子类型 $where .= " AND $wpdb->posts.post_type NOT IN ( 'xxx', 'yyy' )";返回$哪里; } add_filter('comment_feed_where', 'custom_comment_feed_where');[/code]
-
放弃尝试格式化代码......