Title: Post Grid- Exclude Latest Post
Last modified: August 12, 2020

---

# Post Grid- Exclude Latest Post

 *  Resolved [DK](https://wordpress.org/support/users/dip-recipes/)
 * (@dip-recipes)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/post-grid-exclude-latest-post/)
 * Is there anyway to exclude the latest (most recent) post from a post grid?
 * I’m highlighting my latest post on my homepage, but I’d also like to do a post
   grid of my most recent posts (but exclude the latest one since I’m already showing
   it in a different way.
 * Thanks!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fpost-grid-exclude-latest-post%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Support [Team Brainstorm Force](https://wordpress.org/support/users/brainstormteam/)
 * (@brainstormteam)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/post-grid-exclude-latest-post/#post-13248274)
 * Hello [@dip-recipes](https://wordpress.org/support/users/dip-recipes/) ,
 * Yes, you can exclude the latest post form the Post Grid block.
 * Please follow this [video](https://a.cl.ly/bLuRjbnl).
 * I hope this helps.
 * Regards,
    Sweta
 *  Thread Starter [DK](https://wordpress.org/support/users/dip-recipes/)
 * (@dip-recipes)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/post-grid-exclude-latest-post/#post-13253261)
 * I had tried this, but this seems to be if I want to add a grid to a post and 
   have it exclude that particular post (the current post).
 * In my case, I have a static page, not a post. I want to exclude the most recent
   post from a specific grid. Hopefully that makes sense.
 *  Plugin Support [Team Brainstorm Force](https://wordpress.org/support/users/brainstormteam/)
 * (@brainstormteam)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/post-grid-exclude-latest-post/#post-13255677)
 * Hello [@dip-recipes](https://wordpress.org/support/users/dip-recipes/) ,
 * You can exclude posts from the **Post Grid block** using the following filter.
 * To do that please follow the following steps:-
    - To apply different filters for a specific block you need to add a unique class
      to the block from the [Advanced Tab](https://imgur.com/qAye5Tn) of Post Grid
      Block.
    - You need to get the [post IDs](https://imgur.com/oaQlfqi) of the Pages or 
      Posts you want to exclude.
    - After that, you need to add the following filter in your child theme’s functions.
      php file.
 *     ```
       function filter_post_query( $query_args, $attributes) {
           // Unique class name added from Advanced tab for Post Grid.
           if ( 'my-post-grid-class' == $attributes['className'] ) {
               // 123 and 456 is the post id you want to exclude.
               $query_args['post__not_in'] = array( 123,456 );
           }
           return $query_args;
       }
       add_filter( 'uagb_post_query_args_grid', 'filter_post_query', 10, 2 );
       ```
   
 * I hope this helps. Let me know how it goes.
 * Regards,
    Sweta
 *  Thread Starter [DK](https://wordpress.org/support/users/dip-recipes/)
 * (@dip-recipes)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/post-grid-exclude-latest-post/#post-13257588)
 * Awesome, thank you so much!
 *  [dobbylan](https://wordpress.org/support/users/dobbylan/)
 * (@dobbylan)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/post-grid-exclude-latest-post/#post-13263328)
 * I have the same requirement. Maybe this could be a feature of Post Grid.
    -  This reply was modified 5 years, 9 months ago by [dobbylan](https://wordpress.org/support/users/dobbylan/).
 *  Thread Starter [DK](https://wordpress.org/support/users/dip-recipes/)
 * (@dip-recipes)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/post-grid-exclude-latest-post/#post-13264376)
 * Yes, I’d love to see this as an added feature.
 * The code above works, but I have to manually update it with the latest post ID
   every time I add a new post.
 *  Plugin Support [Team Brainstorm Force](https://wordpress.org/support/users/brainstormteam/)
 * (@brainstormteam)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/post-grid-exclude-latest-post/#post-13266231)
 * Hello [@dip-recipes](https://wordpress.org/support/users/dip-recipes/) ,
 * I’m glad it works out for you. Thanks for letting me know.
 * I will surely convey your feedback to our concerned developers. I’ll put forward
   your thought about this to our team and if feasible we will try to improve the
   scenario in our future updates.
 * If you have any further queries, please don’t hesitate to contact us.
 * Regards,
    Sweta

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

The topic ‘Post Grid- Exclude Latest Post’ is closed to new replies.

 * ![](https://ps.w.org/ultimate-addons-for-gutenberg/assets/icon-256x256.gif?rev
   =3240412)
 * [Spectra Gutenberg Blocks – Website Builder for the Block Editor](https://wordpress.org/plugins/ultimate-addons-for-gutenberg/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ultimate-addons-for-gutenberg/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ultimate-addons-for-gutenberg/)
 * [Active Topics](https://wordpress.org/support/plugin/ultimate-addons-for-gutenberg/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ultimate-addons-for-gutenberg/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ultimate-addons-for-gutenberg/reviews/)

 * 7 replies
 * 3 participants
 * Last reply from: [Team Brainstorm Force](https://wordpress.org/support/users/brainstormteam/)
 * Last activity: [5 years, 9 months ago](https://wordpress.org/support/topic/post-grid-exclude-latest-post/#post-13266231)
 * Status: resolved