Title: Posts from current category
Last modified: December 20, 2021

---

# Posts from current category

 *  Resolved [Roman](https://wordpress.org/support/users/vladroman/)
 * (@vladroman)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/posts-from-current-category-3/)
 * Hello!
 * Recent Posts Widget With Thumbnails 7.1.1
 * Just tested your plugin and very like it at all, but need special function.
 * I need to show recent posts only for category (include all childs) of the current
   post (just its main category). This means list of recent posts will be different
   for posts from different categories.
 * Can I do this with your plugin without directly editing its code?
    I didn’t find
   this in options. But maybe I can use any hooks for that?

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

 *  Thread Starter [Roman](https://wordpress.org/support/users/vladroman/)
 * (@vladroman)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/posts-from-current-category-3/#post-15182076)
 * Checked your code. 🙂
 * Looks like this will work for me.
 *     ```
       add_filter( 'rpwwt_widget_posts_args', 'rpwwt_change_category' );
       function rpwwt_change_category( $query_args ) {
           $current_cat_id = ... // A lot of code for getting value correctly. :)
   
           $query_args['cat'] = $current_cat_id;
           return $query_args;
       }
       ```
   
 * Thank you for not fogetting to add filter in WP_Query request.
 *  Thread Starter [Roman](https://wordpress.org/support/users/vladroman/)
 * (@vladroman)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/posts-from-current-category-3/#post-15182171)
 * Just now a small problem – this works at same time for all widgest, created by
   your plugin. 🙂
 * If I want to use more than 1 widget with recent posts, but only 1 with current
   category post list, this become a problem.
 * Any solution? 🙂
 *  Plugin Author [Kybernetik Services](https://wordpress.org/support/users/kybernetikservices/)
 * (@kybernetikservices)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/posts-from-current-category-3/#post-15183924)
 * Hello [@vladroman](https://wordpress.org/support/users/vladroman/) .
 * Thank you for reaching out.
    I’m happy you found the solution by yourself. Regarding
   your “small problem”: There is no build in solution. I can imagine to add a conditional
   statement in the function for the filter to modify the category id only for a
   specific widget, based on the `$query_args`.
 * I am sorry that I cannot help with a better solution.
 *  Thread Starter [Roman](https://wordpress.org/support/users/vladroman/)
 * (@vladroman)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/posts-from-current-category-3/#post-15186495)
 * Yeah, I did like that. Modification works only for specific post type.
 * Anyway, maybe somewhen you will find time and add to your plugin option for filter
   recent posts by current category. This will be great! 🙂

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

The topic ‘Posts from current category’ is closed to new replies.

 * ![](https://ps.w.org/recent-posts-widget-with-thumbnails/assets/icon-256x256.
   png?rev=2478511)
 * [Recent Posts Widget With Thumbnails](https://wordpress.org/plugins/recent-posts-widget-with-thumbnails/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/recent-posts-widget-with-thumbnails/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/recent-posts-widget-with-thumbnails/)
 * [Active Topics](https://wordpress.org/support/plugin/recent-posts-widget-with-thumbnails/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/recent-posts-widget-with-thumbnails/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/recent-posts-widget-with-thumbnails/reviews/)

## Tags

 * [current category](https://wordpress.org/support/topic-tag/current-category/)

 * 4 replies
 * 2 participants
 * Last reply from: [Roman](https://wordpress.org/support/users/vladroman/)
 * Last activity: [4 years, 4 months ago](https://wordpress.org/support/topic/posts-from-current-category-3/#post-15186495)
 * Status: resolved