Already figured it out and seems to be working just fine.
// set up or arguments for our custom query
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
$category = single_cat_title('', false);
$query_args = array(
'post_type' => 'post',
'category_name' => $category,
'posts_per_page' => 3,
'paged' => $paged
);
Related Posts:
- Query post category & remove any post id
- Sort Posts Alphabetically Based on Specific Category (Divi)
- How to show related posts by category
- How to add category to: ‘wp-admin/post-new.php’?
- Display all posts from specific categories on a page
- Query posts from current year
- Query only Posts from Both of Two Category?
- Order post by year DESC and month ASC
- Featured Posts for Category Pages
- Exclude posts with empty post_content in wp_query
- Improving WP_Query for performance when random posts are ordered
- Random post category URL
- Category Foreach keeps looping?
- Assign category to new post via URL
- filter RSS feed in URL
- WordPress custom Query for Posts in Category display posts multiple times
- How can I setup a relationship using categories in WordPress?
- posts_per_page option limits the number of Gallery items
- How to make multiple sections in home pulling posts category wise?
- Counter is skipping post when I still want it visible [closed]
- Query for first 3 posts to change the look and feel
- How to give classname to post if post has no content?
- All categories displays the same posts
- WordPress displays post on subcategory only
- How to get posts ordered by using their categories?
- How to display only one category in a custom post type?
- Getting posts from some categories plus some individual posts
- Get current taxonomy and display query accordingly
- Can I show category name in url for only one of my categories?
- How to fetch courses in all languages in WordPress?
- Does having category name in permalinks affect SEO when having a post in multiple categories?
- How to add a ‘News’ section to specific posts in WordPress
- How to display particular categorie’s post which associated to specific user?
- Show 5 posts and than 3 posts offset with pagination
- AJAX load more posts not using correct category and repeating the same few posts
- How to run select query of post with category and tags?
- Query posts from newest category
- Sort Events by Venue Title – Sort Post set by related post ids
- Need help writing loop to display posts by categories in separate divs
- Sort / Filter Queries
- How can I display a specific number of post in a category via a url
- Ordering posts alphabetically by meta keys and title
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- How to pass multiple checkbox values to wordpress query?
- Sort post by category using HTML Select tag
- Creating pages and getting their values from the database table
- How to limit post query to only return a total count of items with certain post statuses?
- Change from all posts to specific categories post on main page?
- Do I need to create a multisite for querying posts from multiple WordPress sites?
- List only child categories a post is in, of a specific parent category
- Can’t show comments count per post outside loop
- is there a better way of combining this?
- wp_list_categories link to first post of category instead of calling taxonomy template
- How to Add ‘Post Categories’ to the Dashboard Sidebar
- How only display all post related to category
- Add category to all post by using sql query?
- Only display posts after current date
- WP_Query Authors OR Categories
- Post categories to pages
- If in_category not working for multiple single.php pages
- Multi row post list
- Set Default Category to Username
- Dynamically switch template on click
- Get all custom post types excepted some…
- How show categories in admin and get that selected to show posts in index
- Do not show children of a category
- if in category but only with post meta
- Display selected categories onto post page
- How to retrieve certain number of images from a wordpress post?
- WordPress post filter menu
- Some doubts about how the loop work (trying debugging it)
- Change the background of each post according to the category
- Programmatically add posts from specific category to menu
- Get post category as a separate string and url
- How to view all posts (on site, not admin) that are uncategorized?
- How to create a list of links to post with specific category
- query for filtering published posts?
- Trying to exclude custom posts based on date, while sorting by custom field
- Pull in posts using post meta for REST API
- get category in list of posts // shortcode for custom related posts
- How to optimize posts query in wordpress
- Featured Story Shortcode not outputting content
- How to search through “post title” and “tags” using WP_Query?
- Template for displaying CPT / Taxonomy URL issues
- Make recent post display recent updated, instead of recent published
- Numbering author posts in posts query
- If I moved the location of my generic “posts” page, do I need to change the slugs for all of the individual posts?
- Ajax – Post Categories and Load More
- Grab next post title in archive page
- How to organise post by category and date
- Show post if in category
- How to display custom content in post with category XXX
- Displaying categories items among posts
- How to store post rating system data post independent?
- Displaying different posts Via wp_list_categories()
- Display ONLY Latest Post From Several Categories
- Show all posts in category
- Export Posts Without Categories In An XML File
- Need to show birthday of custom post type(Famous people in this case) in elementor. Date of birth set in custom fields