Title: Ignore posts
Last modified: June 13, 2022

---

# Ignore posts

 *  [gracispavel](https://wordpress.org/support/users/gracispavel/)
 * (@gracispavel)
 * [3 years, 12 months ago](https://wordpress.org/support/topic/ignore-posts/)
 * Hello Im trying to ignore ‘post’ using code from your page [https://www.nsp-code.com/ignore-sort-apply-for-certain-query-on-post-types-order/](https://www.nsp-code.com/ignore-sort-apply-for-certain-query-on-post-types-order/)
 *     ```
       add_filter('pto/posts_orderby/ignore', 'theme_pto_posts_orderby', 10, 3);
       function theme_pto_posts_orderby($ignore, $orderBy, $query)
       {
           if( (! is_array($query->query_vars['post_type']) && $query->query_vars['post_type'] == 'post') ||
           (is_array($query->query_vars)   &&  in_array('post', $query->query_vars)))
                   $ignore = TRUE;
           return $ignore;
       }
       ```
   
 * This code unfortunatelly does not work, it ignores ordering for all post_types
   include portfolio. Can you please provide code that ignore post_type ‘post’ only?
 * Thank you very much.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Maya](https://wordpress.org/support/users/tdgu/)
 * (@tdgu)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/ignore-posts/#post-15748559)
 * Hi,
    The code looks right to me, if need to ignore the order for post queries.
   Might be worth trying and checking if the $query->query_vars[‘post_type’] is 
   not empty, as if does, is a post query actually. So the code becomes:
 *     ```
       add_filter('pto/posts_orderby/ignore', 'theme_pto_posts_orderby', 10, 3);
           function theme_pto_posts_orderby($ignore, $orderBy, $query)
           {
               if( 
               ( ! isset ( $query->query_vars['post_type'] )   ||  empty ( $query->query_vars['post_type'] ) ) ||
               (! is_array($query->query_vars['post_type']) && $query->query_vars['post_type'] == 'post') ||
               (is_array($query->query_vars)   &&  in_array('post', $query->query_vars)))
                       $ignore = TRUE;
               return $ignore;
           }
       ```
   
 * Thanks
 *  Thread Starter [gracispavel](https://wordpress.org/support/users/gracispavel/)
 * (@gracispavel)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/ignore-posts/#post-15753165)
 * Unfortunately that didnt help me. Same as before, this code block all taxonomies
   not only post taxonomy.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Ignore posts’ is closed to new replies.

 * ![](https://ps.w.org/post-types-order/assets/icon-128x128.png?rev=1226428)
 * [Post Types Order](https://wordpress.org/plugins/post-types-order/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/post-types-order/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/post-types-order/)
 * [Active Topics](https://wordpress.org/support/plugin/post-types-order/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/post-types-order/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/post-types-order/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [gracispavel](https://wordpress.org/support/users/gracispavel/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/ignore-posts/#post-15753165)
 * Status: not resolved