You need to pass more query arguments. In this case you need:
$args = array(
'post_type' => 'post',
'posts_per_page' => $instance['limit'],
'category__in' => $id
);
Where $id
is the category id, not the post id.
Related Posts:
- Using wp_category_checklist in a widget
- How to remove the parentheses from the category widget
- How to create a widgetized sidebar for every category dynamically?
- Customizing Default Categories Widget
- Display all posts with same title
- I want to create a posts widget and be able to select categories
- How to have Multiple Archives Widgets, one archive widget per category (in a different page)?
- Categories lose hierarchy order once assigned to post
- Add Icons to the Product Category Sidebar Widget WooCommerce
- How to display widgets inside a page content without a plugin?
- How do you categorize pages?
- WordPress category widget only show categories with children
- Customize WordPress widget – Product Category
- Post Count for Categories, however not to calculate a total
- How do I make the category sidebar widget (stock) display the total # of posts including those in subcategories?
- Categories widget show empty?
- Is it possible to remove from default category widget?
- how to remove the default title of Categories widget
- How to show 5 posts from specific category on related page?
- display a widget on specific category and its sub categories
- Multiple selection for wordpress widget
- How to Sync Menu, Widgets and other masters from Main Website to its Sub Site
- Tags Instead of Category
- How to hide widget from certain category
- Last x Posted Categories?
- WordPress category filters as subcategories
- exclude certain categories form archive widget
- Conditional widget for theme template file
- Add filter for specific category only
- Exclude a category from block editor’s category widget
- How can I display the category name in the single post when using WP Blog and Widget?
- How to Change Sort Order of default WordPress Catgory Widgets?
- How to add an “All” category to the tag cloud?
- Custom file with special code of category widget
- in_category(‘category-sluga’) returns true for Archive page of Category ‘category-slugb’
- Problem with single posts not showing correct category sidebar
- How To Disable Category Hierarchy In Categories Widget?
- single category widget with conditional terms
- Customize category query in widget
- How can I create a category landing page followed by pages of posts?
- Custom permalink structure leads to be 404 on pagination
- Exclude the category from the WordPress loop
- How to make child categories recognize parent’s template displays
- Show div only if post is in specific category
- How to show a category post to a specific registered user
- Get id of category from drop down menu
- How can I only show certain posts?
- Category menu item and its last 10 posts as sub-menu
- Prevent function from triggering again when post in specific category gets another category?
- Sort post’s categories by ID
- Set the default category of an attachment
- exclude post from displaying in loop if it is in a category, but not in many categories
- Show Featured products in product category pages
- Set post categories to include parents when setting child category
- How to remove category titles?
- Get only one of the current categories
- Show Available Taxonomy List with Current Category
- How to get grandparent of a given category
- Updating category template to change how subcategories display
- Create menu / submenu from category subcategory and posts
- Add a custom category page in WordPress.org
- Remove the parent name from permalink
- Make parent category an optgroup
- wp_dropdown_categories not showing option as selected
- How to check if a post belongs to a category that has only 1 posts?
- How do I use just one category’ posts on my home page?
- How can I display tags as categories?
- On the Blogpost I have categories showing, is there a way to exclude a catgegory like ‘Media’?
- Set category page title in custom theme [closed]
- Posts from a category on homepage with category archieves page default css
- Need to echo category id in multi-dimensional array
- Use blog as base for tags and categories
- Exclude parent category when getting category posts by slug
- category link not working for a specific slug, works for others
- Can’t iterate through 2 levels of categories
- Update custom category fields front-end
- Include last post date in get_categories loop
- Categories not posts at the frontpage
- Add Post Categories in Post Tags Field Programmatically
- How do I remove “Uncategorized” from my theme on my posts page?
- Conditional label Woocommerce archive [unsolved]
- Removing catagory for new blog pages
- Filter custom taxonomy posts via AJAX
- set a parent category in a product woocommerce
- “Next posts” of a category do not call category.php
- Trying to display all posts in a category
- Remove “Category:”
- How to grab posts from the most recently created category
- Match two taxonomies to display a specific content
- How to count the number of monthly archive?
- Modify / Rewrite single template url structure
- Most efficient use of custom taxonomies, categories, and pages
- AZ Directory category
- category filter doesn’t work
- how to edit wp category widget
- In a url where Category Id is wrong It is showing wrong it is going to the page not found page
- how wordpress generates permalinks as /%category%/%post%/
- Link to page in category
- get_category_children/ the new get_term_children not work
- wp_list_categories() not listing categories