I would recommend becoming intimately familiar with the WP_Query parameters:
https://developer.wordpress.org/reference/classes/wp_query/
In your particular case; dealing with taxonomies:
https://developer.wordpress.org/reference/classes/wp_query/#taxonomy-parameters
Here is the proper code to pull from a taxonomy:
$args = array(
'post_type' => 'post',
'tax_query' => array(
array(
'taxonomy' => 'units',
'field' => 'slug',
'terms' => $term->slug
),
),
);
$query = new WP_Query( $args );
The taxonomy should be the slug of your registered taxonomy. In this case, I’m assuming units.
Related Posts:
- Order get_terms using a Custom Field
- Get value in custom field with taxonomy [closed]
- Remove Category description textarea
- Custom Taxonomy Images with Advanced Custom Fields
- Advanced custom fields – taxonomy terms images [closed]
- Displaying ACF image field [closed]
- Operations with custom fields values in a loop
- ACF vs Taxonomies
- Specifying a size when displaying an image associated with a taxonomy through ACF
- How to add contents of a custom field to a taxonomy term list?
- Search Tool only refreshes Page without showing results
- Display value of custom field of custom taxonomy in single post?
- How to fetch the data from Advanced Custom post when we search specific keyword or field name related to the post?
- WordPress implode & wp_insert_post question
- Website loading slowly – Advanced Custom Fields images
- Display a colour of custom taxonomy on the page
- Can’t get taxonomy ID for each post on archive page
- Loop to display ONLY custom taxonomy parent information [closed]
- Using Advanced Custom Fields Relationship Field to select a taxonomy term
- query to use to link to taxonomy single page
- Show related posts on single.php, grouped by taxonomy terms, with Advanced Custom Field post object selected
- Why do my quick edits for custom taxonomies not show on the post frontend?
- Echo ACF taxonomy field within a foreach for another taxonomy
- new custom filed not showing in taxonomy
- Connect ACF field + custom taxonomy [closed]
- Adding Advanced Custom Fields to posts
- ACF Field, hide taxonomy title and image when no nothing selected in post
- ACF Custom field not showing in Timber Taxonomy page
- WordPress search form and search result through ACF field in custom taxonomy
- How to show selected check box vendors on front end home page?
- Creating a list with multiple categoreis and options
- Taxonomies, Adanced Custom Fields and Repeatable Fields
- ACF Display Taxonomy Image Field
- Gravity Forms with Advanced Post Creation Add-On not updating ACF fields on custom taxonomy
- ACF – How to get custom taxonomy term image field
- How to modify a taxonomy that’s already registered
- Change order of Custom Taxonomy List
- Why is my working Custom Taxonomy not in get_taxonomies array?
- Custom taxonomy listing page when no term set (all terms)
- Custom order of terms for custom taxonomy in admin and website
- RSS Feed for posts containing any term from a taxonomy
- Exclude Child Term Posts from Parent Term Archive
- Use custom posts as taxonomy term meta replacement?
- Retrieve a specific field from taxonomy term through advanced custom fields [closed]
- Taxonomies not appearing in columns on dashboard
- Make Custom Taxonomy Category Use Parent Template
- Custom taxonomy template not working
- How to get terms of a custom post type in a loop inside footer.php
- List only first-level children of specific custom taxonomy term
- Sorting Posts Via Custom Taxonomy Values Using Checkboxes?
- get_terms of post->id
- get / list categories and counts filtered by custom taxonomy term
- Refine user taxonomy query based on role
- Get ID and slug from taxonomy object
- List the number of posts for each custom taxonomy and specific custom field value
- wp_insert_post not updating custom taxonomy selected if logged in as a subscriber
- How to overwrite registered taxonomy url from vendor plugin in child theme
- Dynamic loading of Archive content based on custom taxonomy term name
- Checking return with WP Error
- Why is the custom taxonomy archive page redirecting me to a single post? [closed]
- Rewrite URL for taxonomy listing
- Return terms from multiple taxonomies using $wpdb
- Failure to add term meta
- Filter custom taxonomy archive posts by 2nd custom taxonomy using select dropdown
- How to show all post related taxonomies
- limit post by a taxonomy in the admin
- WordPress Custom post query sorting does not work
- WordPress set taxonomy on post?
- How to find taxonomy parent id from child taxonomy page?
- Removing “trashed” posts from post count in custom taxonomy terms?
- Best way to redirect taxonomy terms to pages
- WordPress cannot find user taxonomies on frontend
- Taxonomy archive template that shows posts from more than one taxonomy
- Hide echo of no categories from get_object_taxonomies
- How to get the term description in a taxonomy term archive query?
- Chaining Taxonomy Queries
- Drop-down filter doesn’t retrieve custom taxonomies
- How Can I Remove Child Slug From Grandchild Slug When Using Duplicate Grandchild Slugs?
- How to filter and/or sort user taxonomy query inside custom user taxonomy archive page?
- Admin only taxonomies?
- Rewriting url for multiple Taxonomies and Custom Post Type
- Why is the category item count not updating after assigning a category?
- Add custom taxonomy for post using cron job
- Dropdown (with onChange) with custom taxonomies
- Custom column into custom taxonomy (img tag with slug-name as file name)
- How to get a terms and posts associated with another term?
- Displaying subcategories and then posts in taxonomy template
- How to use two same taxonomy in same post differently?
- How to show one post content in another post content which has same terms?
- How to set “manage categories” capabilities on a post type taxonomy but not on the general categories?
- Custom taxonomy name not being translated in post manager page
- Include attachments with a custom taxonomy in search
- Can I use multi (sub) levels of relation (AND | OR) on custom query?
- Avoiding stripping of HTML in Custom Taxonomy Meta Field
- How to update WordPress custom SQL Select query for custom taxonomies so that syntax is correct?
- Display term description on hover using get_the_term_list
- Can I use get_term_children to show child terms if they exist and show something else if they don’t?
- Displaying the custom taxonomies side by side on the admin dashboard
- How to add a custom page template selector to a custom taxonomy?
- Taxonomy term template is not working