SOLVED
This was what I was looking for and it works like a charm.
function my_query_args($query_args, $grid_name) {
$term_list = get_the_terms( get_the_ID(), 'category' )[0]->slug;
if ($grid_name == 'JTS-SINGLE') {
$query_args['tax_query'] = array(
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => array( $term_list ),
),
);
}
return $query_args;
}
add_filter('tg_wp_query_args', 'my_query_args', 10, 2);
Related Posts:
- Order posts (across the whole site) by metadata date
- Sort posts by Date (DESC) and by Title (ASC)
- Filter the query ONLY for the search results page
- Functions.php: If its single?
- Best way to programatically add “rel” attributes to page and post images
- Is it good practice to use wpdb->query() function?
- exclude a category from a search on a specific page
- example of build_query function?
- Shortcode pagination not advancing
- Add caption functionality to custom WordPress theme
- Create a new query in function.php to filter blog posts
- Connecting to a 2nd DB gives me no results when querying
- How to ignore posts in pre_get_posts?
- Best way to disable sidebars on posts (only)?
- shorthand syntax for custom fields
- Insert a field with PREG_REPLACE – strange behaviour
- I would like single.php to act just like index.php
- Using One Function To Create Two Different Shortcodes
- Delete oldest wordpress post (SQL query)
- Selecting specific query for offset
- Why isn’t comment validation working?
- How to display different blocks for mobile and desktops
- Using AJAX on frontend: Synchronous XMLHttpRequest deprecation except for admin role
- Shortcode with pagination advancing multiple queries
- Function returning queried meta value based on current post ID
- Sorting date results from a query
- Show stuff everywhere except single post?
- Is it ok to use a function to output the text domain name in a wordpress theme
- How to override a function when isn’t at functions.php
- contactform7 remove tags with “wpcf7_autop false” from functions.php
- How to count number of functions attached to an action hook?
- Show modified time if post is actually modified
- ajax live search for post title
- Hourly Routine Not Firing ( wp_schedule_event() )
- How to get an array of menu items from the toolbar?
- Fatal error: Call to undefined function add_action() – an untouched problem
- echo or print_r in an admin function
- Editing or filtering the output of the Genesis navigation
- Automatically Add Specified Value to Attachment Metadata upon Upload
- Twenty Eleven Child theme error when attempting to use a rewritten function
- Display gallery on top before content
- List of Body Classes Generated by body_class()
- is_dynamic_sidebar always returns true while using Jetpack visibility
- wp_trash_post function to only apply to posts, not pages!
- Redirect specific page in WordPress for first time visit
- qTranslate in functions.php
- Using Schema with `the_excerpt`
- Image rotation fails to regenerate custom sized thumbnail
- Register and load scripts
- Display alert on successful user Sign Up
- Getting different functions data while using while loop in wordpress
- How to rewrite the custom url in wordpress?
- About cron delete user with meta_key
- Set spesific size of featured images
- Excerpts are not displayed by a shortcode on category pages
- Getting comment count per post not working
- Functions.php Problem
- It does not work concatenation in function.php
- Get arguments from URL
- Where do I store custom functions that call custom page template files?
- Excerpt for pages not showing
- Can’t Write Custom Widget Code In One ECHO
- Got white blank page after copying the functions.php to child theme
- Insert nofollow in a “Powered By” link, except in the homepage [closed]
- Image loading function not working on archive.php template
- what is best way to keep track of changes made in wordpress website? [closed]
- Do we need to change our child function.php to require/include child dir files when we add an over-riding file.php into the child theme
- Child theme functions.php
- How to echo Widget Title in Custom Frontend-Template Box
- Redirect to post after publish or update a published post
- Page Template Won’t Load Correct CSS File
- WordPress show bad the php hour and date
- show all the posts thumbnails
- the_excerpt function not showing image
- How to display this meta data (an array) in form of a function (created with a custom write panel)?
- WordPress – using sessions?
- Use a filter for wp_robots to block CPT/feed/
- Trigger email alert if file downloaded
- Completely Disable WordPress RSS Feeds
- Order column custom date using pre_get_posts
- query_vars treat as single var from URL
- Running javascript without hooking wp_head
- Remove text after a dot and a colon in Woocommerce product title
- Enable CORS Request for hostname using IP address
- Change default color scheme in twentyfifteen child theme?
- Restrict access if logged out except for homepage
- Add meta data in head from theme
- what is `get_section()` and how to use it?
- DISABLE wordpress upgrade page
- How to echo the translated custom field?
- Only Show One Category Name Per Post
- Moving CDN jQuery to footer does not work?
- Pass max posts to Javascript
- update_usermeta don’t work
- Query child posts on parents single.php?
- WP supersize not displaying when different languages flags are selected
- How do I make my child theme’s CSS update when I save it?
- Bulk set Post Title as Tag where Tag is Empty Function
- Convert Image to Webp on upload without plugin
- How to automatically load Google Fonts on pages only as they’re used?