First you need to fetch the current category, then grab posts. So, try
<ul>
<?php
global $post;
$category = get_the_category($post->ID);
$args = array( 'numberposts' => -1, 'offset'=> 1, 'category' => $category );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<li><a href="https://wordpress.stackexchange.com/questions/56247/<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
Related Posts:
- List all categories with featured image from post?
- Highlighting Current Category in the Archive and Feeds page
- How to display my categories in a list (to a post, not the sidebar)?
- How to get the number of posts in a selected category?
- MySQL Query to Retrieve Category from wp_posts
- Category checkbox list tree changes when editing a post
- Show related posts by category but ignore one category
- How to sort posts by last name (2nd word) on ONE category only?
- Change default screen option value for posts per page
- prevent showing posts of an specific category in admin posts section
- Add custom field to category of custom post type
- Can I hide a specific post from latest posts page?
- Auto set Post to Specific Categories
- How to show post(excerpt) from specific category on wp page?
- New blog template to display only one category
- Save list from a custom meta box?
- WordPress – Admin Manage Posts – Multiple Filters by Parent Category
- Custom Theme Want To Remove One Category From All Displays
- Divide Loop Into Days & Categories
- How can I list random authors from current post category?
- Different template for posts of all subcategories of category
- How do I render all posts of the same category in same layout?
- WordPress list posts from sub categories
- Mark menu item as current-menu-item for category
- How to set up multiple taxonomies for groups of posts
- How to filter posts that belong to a specific category only if that is the only category
- List posts in a given category
- How to display category from recent posts?
- Can I divide the pages into categories?
- Child_of not displaying all children posts.. via get_posts
- Duplicate posts and change category
- Category Foreach keeps looping?
- display a random post thumbnail from a random category
- How can i limit the number of posts created per category?
- Post page to display specific category
- Get Posts Under Custom Taxonomy
- Prevent additional top level categories but allow more children
- how to show single post in a custom template
- Excluding posts not working
- Hide posts belongs to few categories in homepage
- post category in wp_insert_post
- Limit the number of posts a category can have – newest post goes in, oldest one drops out, possible? plugin?
- Remove current category from post but display all others
- Display posts of specific category term
- Widget that shows categories with posts numbers
- How do I show posts from another wordpress installation?
- Latest posts by category — how to exclude current post?
- How do I include the category next to the title of a post?
- Relative number of post in category
- How to show a custom taxonomy in the theme?
- How to import nested categories from XML file?
- How to get post with associated categories and tags names instead of ids with rest api?
- Migrate posts from category and sub-category via SQL
- Posts Missing in Dashboard after update
- Display post number by category
- How to get post with slug and exclude categories
- List all posts, pages and custom post types in admin
- Retrieving posts by their date and category
- Are post, page and category IDs unique to each other?
- Static pages not working
- WordPress displays post on subcategory only
- Remove Featured Image from posts in specific category?
- How to list post as buch of category, and all of them
- Categories Listing and Highlighting current category item
- How to display list of results
- Display hierarchical categories/sub-categories for a single post only
- Remove subcategory slug from url
- Is there a way to categorize a list posts all at once?
- Author post count in category
- On the online version of my blog posts disappear
- Why do I have categories with duplicate slugs?
- Automatic Table of contents with categories and posts
- More Than 50K Categories and WordPress Admin Panel Stop Showing Categories and Posts
- Re-order Category Meta-data
- Is it possible to remove actual post pages in wordpress but keep them in categories
- Need help with hiding an image within a post in a category
- WordPress not showing recent posts
- How to get post count including nested categories
- How to filter out post from a category not its subcategory in wordpress dashboard
- List posts of assigned categories in list of all categories on single.php
- How can I display a specific number of post in a category via a url
- how to chang preview of list of articles of one category?
- Post of a specific category – not to be seen in paging previous/next post
- How to show main category related to that post
- Display selected category on post page
- find posts with exactly 3/4 categories
- Sort post by category using HTML Select tag
- Make assigning post to a specific category equivalent to assigning it to all categories
- How to use in_category?
- About number of posts in selected category
- Displaying only posts from a certain category on my custom page template
- WP_Query: Fetch posts that are in (category1 and not in category2), OR posts that are not in cagegory1
- Multiple blog “feeds” in a single blog each with distinctly styled post pages
- How to get pagination working with “Pending” Posts
- Post’s arent displaying
- Show with echo if a post has two or more categories
- How can I get on the same row two post of different categories?
- How can I fixe the article title problem?
- Automatically select category based on user role
- Filters do not work when there are multiple (one works)