There are a few things wrong:
-
In your code you are using the same $args array in the WP_Query call that you used in your get_terms call. Perhaps you meant to use $postargs in the WP_Query call?
-
@Milo is correct…you should be using posts_per_page, not number.
-
Your tax_query array element ‘field’ says ‘name’ but you pass it the term slug and not the term name.
Hopefully this helps: Here is the reference
Related Posts:
- Loop through ACF taxonomies and output associated posts
- Jquery Slider for profile template
- Retrieve each widget separately from a sidebar
- Should I use loop in the single.php file?
- how to upload image using wp_handle_upload
- Avoiding using a loop to access a single post
- Adding ‘current_post_item’ class to current post in the loop
- wp_list_categories: get latest featured_image of category
- Where should I use post_class()?
- Landing Page – Redirect Loop?
- Sort Popular Posts by Views for the Last Week
- get_the_foo() in the loop – does it perform another query?
- Exclude filter on front page
- Is it possible to display previous post revision?
- Check if date of post is yesterday
- Exclude first 2 posts with meta_key from loop
- Fix inefficient loop breaks post.php on form submit
- Make a custom loop inside single.php with pagination
- Why do I get `Call to a member function have_posts() on a non-object `? [closed]
- Adding shortcode closing tag after a loop
- Get Pagination (WP-PageNavi) not to work
- Filtering The Loop For Single Page and Blog Page
- the_content() seems to block my ACF-code
- Pulling current post/page data into header.php
- Removing the_content() from the page
- Loop and Page template : my WP_query don’t take args
- How to split a loop into two columns
- Category Ajax call
- Transient loop issue
- popular post weekly and monthly
- Filter the loop by categories using checkbox form
- Get single post from tags array
- Duplicated posts on category page
- WordPress loop: exclude if it is the latest post
- Apply an Incremental Counter in an Array Function
- Get all posts including sticky ones with get_posts(),setup_postdata(), and foreach loop?
- Page-loop is looping content from custom loops on the same site. How to avoid that?
- Latest Post Styled Different Than other Posts
- WordPress: Loop Help
- Custom taxonomy.php not working
- Woocommerce: How to display product price [closed]
- Display Post Author Link above the loop
- Enabling users to control custom loop’s query
- Loop counter style
- Can I add generic numbering HTML classes to items as a loop runs?
- Add “showing posts x to x of y” in custom post type paginated loop
- Custom Post Type on Homepage – Studiopress Genesis Framework
- New loop vs widget
- Display a single category in blog section
- Query Nopaging action not having effect
- display post format text in loop
- Yoast taking over my WordPress title tag [closed]
- Pagination broken after using 2 loops to show content
- Getting page slug
- How to get pagination to work with 2 wordpress loops
- Exclude page from loop results
- How is WordPress changing the content markup?
- Inserting CPT and static content at every X post, is this possible?
- Use BuddyPress data in loop (mkdir)
- Wrap every four posts within a div [duplicate]
- Get most recent post for every term in a given taxonomy type
- loop through posts and display inserted media and post title as a link
- Custom Blog Loop on Home Page
- Exceprt not displaying
- Add File Attachment Name and URL into Javascript
- Open Graph in Index Loop
- How to get post category and author name for cusmot API?
- How to add Default Level-0 parent and Level-1 class in WordPress Category in li element?
- Updating Post meta (ACF field) from Feed
- How to add pagination in Terms
- A code that I could not fully grasp related to foreach & count_user_posts()
- How to separate post titles with a comma in the loop?
- get_posts changes main query
- Trying to get property ‘post_content’ of non-object
- WordPress loop : how to exclude some posts with their status?
- Include only one category but Exclude if is in a category from loop
- Homepage Loop Somehow Breaks Styling Of Post Grid
- WordPress Pages in an Array
- numberposts not responding to wp_reset_postdata()
- Next 10 posts data of currently viewing post in blog page
- Display single post inside accordion based on form submission results
- One page loop issue with posts
- Humanmade | Custom meta box class: How to display a repeatable meta box group?
- Can’t print out returned value
- change the_content images for different sizes (Desktop, tablet, mobile)?
- Building theme so user can change header image [closed]
- Get query result before posts are displayed?
- WordPress Group By Problem
- Home page loop with pagination problem
- WooCommerce custom loop pagination on front page
- Eliminate duplicates in a foreach loop [closed]
- get_page() unlike Loop returns the post content without html tags. How can I fix this?
- Problem with ms-thumb-frame-selected class in Master Slider
- I want the first post on my home page to be lengthier than the rest (example included)
- Output ACF field dynamicaly within a taxonomy loop [closed]
- Loop with Custom Post Type Taxonomies and Interstitial Code
- Question about custom plugin
- loop mix my child-category and parent-category
- How can you make it so the comment box shows on some pages or posts but not all?
- Use Base-URL with Query-Loop