Bug反馈:5.7.1版本里的首页资讯筛选有问题

墨寞 发布于 分类:分享

如题,5.7.1版本里的function wpcom_load_posts() 函数有问题,导致首页的最新资讯里仍然显示已经设置为不显示的分类。跟5.4.0版本的代码对比了一下,发现5.7.1的代码做了一点修改,导致这种问题的发生。改为5.4.0版本的代码即可正常。

问题代码如下:

5.7.1版本

$exclude = isset($_POST['exclude']) ? $_POST['exclude'] : '';
if($exclude) $exclude = explode(',', $exclude);
$exclude = $exclude ? $exclude : array();
$arg = array(
'posts_per_page' => $per_page,
'paged' => $page,
'ignore_sticky_posts' => 0,
'post_type' => 'post',
'post_status' => array( 'publish' ),
'category__not_in' => $exclude
);
$posts = new WP_Query($arg);

5.4.0版本

global $options;
$exclude = isset($_POST['exclude']) ? $_POST['exclude'] : '';
if($exclude) $exclude = explode(',', $exclude);
$exclude = $exclude ? $exclude : $options['newest_exclude'];
$arg = array(
'posts_per_page' => $per_page,
'paged' => $page,
'ignore_sticky_posts' => 0,
'post_type' => 'post',
'post_status' => array( 'publish' ),
'category__not_in' => $exclude ? $exclude : array()
);
$posts = new WP_Query($arg);

折腾老半天才找出来,排除了插件兼容性等因素之后,最终意识到应该是代码的问题,多亏还保留了一份以前的版本:(:(:(:(

3个回复

  • 滄恆
    滄恆

    是的,我也发现这个问题了,希望 能修复下,谢谢!

  • 墨寞
    墨寞

    另外,自定义页面模块main_list的筛选也有问题的。貌似这里的筛选会受到首页列表筛选的影响。希望能修复一下。

  • Lomu
    Lomu

    这个修改是为了适配模块里面的ajax请求,目前最新版已经修复此问题

微信咨询
QQ咨询
扫码关注

扫码关注微信

关注我们获取最新资讯 关注微信公众号 立即扫码关注我们