So I see two things that could contribute to the problem:
- I really doubt you’ll need to
esc_attrfor the query. - This is a tricky one, but tax_query needs to be an array of arrays
Based on this, I believe this will work better for you:
$tax_query = array(
'taxonomy' => 'resources_categories',
'field' => 'slug',
'terms' => array( $category ), // <--------
'operator' => 'IN',
);
$args = array(
'post_type' => 'resources',
'post_status' => 'publish',
'posts_per_page' => $per_page,
'orderby' => $orderby,
'order' => $order,
'tax_query' => array($tax_query) // <--------
);
Hope this helps!
Related Posts:
- How to paginate wordpress [gallery] shortcode?
- What kind of object type is WP_Query?
- Last post ordered by publish date using WP_Query on front page
- Shortcode returns escaped HTML tags
- WP_Query in a shortcode
- ‘&’ causes an error in my shortcode when I list the content of the page
- Can certain (site-crashing) limitations on WP_Query in shortcode be overcome?
- How to retrieve current page WP_Query arguments?
- wp_query add arguments using array_push if variable met
- How to get all child pages in their parent page?
- Database Queries Optimization with new WP_Query
- Orderby is working with one query but not with other
- Shortcode for latest -not expired- posts
- Gallery shortcode numerical sorting
- How to filter a query by date in a shortcode?
- How should I approach changing the template & $query as part of a shortcode’s execution?
- Shortcode Not Working in Slider When Added To Post Title
- Shortcode for custom query not returning results when attributes are added
- How to Display Shortcode in the correct location, currently displaying before content after Page Title?
- WP_query only displays one of my custom post type entries
- Assign a minimum result count for WooCommerce query shortcodes?
- Using a Shortcode to List Posts from Multiple Categories
- embedding shortcodes in php template
- How to get specific string in explode array?
- Trouble passing attribute into shortcode function
- Woocommerce Shortcode which displays a table with product data
- WP Query by 4 different taxonomies
- create custom shortcode wp and put php code in
- How to display a post(by id) along with css in a page?
- Shortcode attributes causes 500 error after updating the page
- pages shortcode filtering by category
- WP_Query & shortcode : Return 3 articles from a category WordPress
- Query by Category and Custom Field – Shortcode
- How to take parameters from a function and make them editable as attributes in a shortcode
- How to modify WP Query to target the first most recent post to adjust content
- Object of class WP_Query could not be converted to int inside shortcode
- How can I create another instance of my custom shortcode
- Get Current CPT taxonomy category in shortcode
- Custom shortcode not displaying categories and correct date
- return wp query results in a shortcode
- More efficient query to display posts in same sub-category?
- Having Trouble Running Query From Shortcode Using Tribe’s Events Plugin
- shortcode using multiple WP_Query’s with multiple category names not fully functional
- Shortcode does not display pagination [duplicate]
- How to write a query-function as a query-shortcode?
- shortcode with $atts with strange results
- WP_query shortcode inside acf Repeater breaks the repeater loop
- How to prevent WP query searching in executed shortcodes
- How to create a three column blog layout with a single query and with three different classes?
- Posts with at least 3 tags of a list of tags
- Use WP_Query with a custom SQL query
- Looping through tabular data
- Using next/previous_posts_link with customised search
- How to detect custom query inside `posts_where` hook?
- Is temporarily overwriting $wp_query a bad idea?
- Array Chunks and Inserting Varying HTML in WP_Query
- How to output different posts per page?
- Modifying the Search Results
- WP_Query times out
- ACF – Get lowest & highest value from field
- How to find a post id using the post_excerpt?
- Complex WP SQL Query
- Hide Administrators From User List except current user (administrator)
- How to figure out redirection and contents in hybrid solution containing word press content and legacy code (ASP.net)
- Category applied to pages, creates multiple breadcrumb entries after a search query (On the translated site)
- How to store and receive variables in WP sessions?
- WP_Query Attachment adds additional attachment count and need to link attachment to post url
- Is there a better way to pull in custom content without querying posts?
- WordPress | Date not always appear [duplicate]
- Multiple Rows in a using wp_query
- “paged” in WP_Query returns 0 posts
- Running multiple WP_Query
- How to split a post and intercalate elements from a loop
- How can I update post meta inside a WP_Query loop or the WordPress loop?
- Printing a variable inside a custom WP_Query
- Creating attachments archive in tags and categories
- How to prevent WP_Query from filtering on ‘s’ but keep ‘s’ for other purposes?
- Query on meta values and post title
- Adding GROUP BY in Custom Query not working with ORDER BY
- Show custom content when loop or wp query reaches specific time?
- Query Order By Number Variable From API
- Wp includes access control
- Sorting query_posts() with a complex orderby filter
- How to exclude posts by ID within a category/archive loop
- Dynamically Update Page Content
- Optimal way to make tags in tax_query optional?
- Bring a post to the top of the query if it’s in a certain category?
- WP Meta Query at depth 2
- WP_query for posts with same post type AND same post category
- WP_Query is being reset after tag (using chaining method)
- Pagination is not working on custom query inside a custom home page template
- Sorting Posts Based On Meta Value Using AJAX
- Sorting: custom query with orderby meta_value_num THEN by title
- WordPress Query showing multiple titles
- custom query to get posts
- Do not show a custom post if it belongs to a certain custom taxonomy
- on attachment.php, how to display previous and next attachment links that follow the same order as a custom WP Query
- loop hierarchical custom post type, child pages only
- Block Editor – WordPress 6.1 – CPT Archive Issue – While the title changes in the loop, all records display the same data
- How to prevent random 302 canonical-ish redirect on custom template