I was missing the condition for the array inside the tax_query array. It is important to have it regardless if you have one or more conditions.
$term_search = get_queried_object()->slug;
// WP_Query arguments
$args = array(
'p' => 'product',
'post_type' => array( 'product' ),
'order' => 'ASC',
'post_per_page' => 20,
'tax_query' => array(array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => $term_search, // (the name of what you want to filter by (latest or whatever))
'include_children' => true,
'operator' => 'IN'
)),
);
Related Posts:
- How to Display Custom Post Type’s Gallery (images ) in Through WP_Query
- Paging on a future post loop?
- Finding posts containing matching array elements in a meta field usign WP_Query
- rewrite_rules problem
- Woocommerce Custom Checkout
- How to get the path to the current theme?
- Why does WordPress use outdated jQuery v1.12.4?
- What is an alternative method to the WordPress private _doing_it_wrong() function
- Check for featured image in WP_Query
- Update exisiting site to 3.5 release candidate
- Get file headers in custom file
- add_filter and remove_filter added before and after wp_query
- What is the difference between strip_tags and wp_filter_nohtml_kses?
- Having Problem On Getting WP Post Gallery Images URL
- How to: get main plugin/theme file?
- How to bundle a plugin with a theme, or vice versa
- Woocommerce add custom button to backend order table
- How do I hook a custom discount to change a WC_Order price total on WooCommerce?
- How Can I setup WP CLI on Windows development machine running AMPPS?
- WP_LOCALIZE_SCRIPT doesn’t work
- What is the difference between these two methods of writing $ instead of jQuery in WordPress [closed]
- Modify a Free Plugin available on wordpress.org & include with my Premium Theme? [closed]
- Print value of an array or variable in a payment plugin
- Best choice of options/settings framework for plugin/theme development
- Is there any way to have Featured Text, as opposed to Featured Image?
- Find source of notice / warning / errors efficiently
- $wpdb -> Batch insert from XML File?
- StackExchange clone using WordPress?
- Sharing common functionality (functions, template parts) between plugins and themes?
- Display content from custom post without modifying the single template
- How do I add custom column to woocommerce cart?
- Can I change header.php of current theme through a plugin function?
- WooCommerce Conditional Tag inside plugin
- Custom attribute type not displaying terms in edit product – WooCommerce
- update woocommere total value on checkout based on selected payment method
- how to add custom functionality after woocommerce place order button
- Tried in different ways but sidebar not working?
- Short code not working in boostrap modal dont no why?
- Is there a way to list all actions registered by a plugin or theme?
- How to hook a custom user function to a wordpress core ajax action?
- PHP – Extend WordPress Woocommerce Revenue Analytics with custom field
- Elementor custom Query with ACF fields to show matching woocommerce products custom fields
- WP Gutenberg Blocks – How to limit first/root blocks
- Following WordPress Markup Is mandatory, got awkward resultyby wordpress standard markup?
- How do I create plugin or theme using MVC pattern?
- PowerPress mobile media player
- When is the proper time to minify css and js with git workflow?
- How to Get Current Custom Post Type Associated Taxonomy Term
- Plugin templates vs Parent Theme
- Warning: include(): https:// wrapper is disabled in the server configuration by allow_url_include=0
- Can’t change the style of a submit input type? [closed]
- Make a plugin page out of influence of the theme’s style
- Custom entity search and display
- How to get the post excerpt using post object?
- 400 Bad Request, in wordpress theme development, wp_ajax
- Issue on Setting $icon_url Parameter on WP add_menu_page()
- Ajax: Populate with content from a post’s ID not working – duplicating current page html instead
- Can woocommerse be used dynamically for billing from another plugin for payment processing?
- How to call code when adding WooCommerce menu items via woocommerce_account_menu_items
- How to replace settings in WordPress plugin from a theme
- Save temporary registration data
- Setting a post’s category
- How can the_excerpt (or equivalent) be called on a category description?
- Remove Products From Category
- Change the behaviour of a button
- Woocommerce Variable Product Dropdown for Custom Shop Template
- Configuring Xdebug with docker compose
- How to access index file in Block Themes?
- How to show comments from different Plugins to same post type?
- Want to know how to reveal a WordPress theme, considering the theme name is hidden?
- Redirection from a specific page for users logged in but not with membership
- Is it possible to develop themes and plugins locally while still allowing content to be updated directly in the admin dashboard?
- WC REST API Error Handling
- How to remove the WooCommerce Product->Category thumbnail from admin [closed]
- Override WooCommerce files from plugin
- woocommerce add a new bulk action in the bulk actions dropdown in the orders list
- Replace “content-area” of themes 404 page with plugin?
- Autoloading & Namespaces in WordPress Plugins & Themes: Can it Work?
- Custom premium registration form and profile page for a WordPress Web Application
- Handle changed Woocommerce function
- Making Woocommerce optimized for more than 500k products
- How to destroy or dispose wordpress uploder/manager?
- Font Awesome stopped showing icons, shows &# text instead [closed]
- To remove rendering of menus and header, plugin or theme?
- Declaring a new woo commerce product type i get this error
- Managing Custom Designed Content
- Generate activation url
- Display Data’s metabox in page
- Ajax functions – no access to wp-admin.php only online
- Saving multiple fields as array
- How can I make my website with wordpress having on-spot editing feature as compared to concrete5 CMS?
- How to design WooCommerce-like admin tabs for plugin settings page?
- Woocommerce: block user removing cart item
- Gutenberg text field validation
- How to get the value entered in the input field in wordpres
- WooCommerce adds a newline symbol (\n) between email recipients
- Why isn’t custom sidebar panel not showing up in the Gutenberg Editor?
- Allow HTML in product attributes and variation for WooCommerce
- How do I add multiple custom menu Woo-commerce my account page?
- High-Performance Order Storage conflict action `manage_shop_order_posts_custom_column`