开发者

Filter to exclude pages results in "white" page on site and no errors in the log

开发者 https://www.devze.com 2023-03-10 21:35 出处:网络
function mySe开发者_Go百科archFilter($query) { if ($query->is_search) { // Exclude PlugStore from Search
    function mySe开发者_Go百科archFilter($query) {
    if ($query->is_search) {
    // Exclude PlugStore from Search
      $mypages = get_pages('child_of=1284');
      $idlist = array(1284);
      foreach ($mypages as $pagg) {
               $idlist[] = $pagg->ID;
      }
      $query->set('post__not_in', $idlist);
    }
    return $query;
}

    add_filter('pre_get_posts','mySearchFilter');

I have adjusted this question as I fixed the "white page" problem, but the code is still not excluding the pages whose parent page is 1284. Can any one spot my mistake please.

0

精彩评论

暂无评论...
验证码 换一张
取 消