The WP_Term_Query
class doesn’t have a method named set
, and calling $query->set()
in my case resulted in a fatal/critical error saying “Call to undefined method WP_Term_Query::set()“. :/
But you can directly modify the query_vars
property (i.e. $query->query_vars
), like so, to set, unset or override any query variables like meta_query
:
// Use this:
$query->query_vars['meta_query'] = $meta_query;
// NOT this (which causes a fatal error):
$query->set( 'meta_query', $meta_query );
Or you could instead use the get_terms_args
hook:
add_filter( 'get_terms_args', 'filter_cat_by_u_id' );
function filter_cat_by_u_id( $args ) {
global $pagenow;
if ( is_admin() && 'edit-tags.php' === $pagenow ) {
$args['meta_query'] = array( your code here );
}
return $args;
}
Related Posts:
- Hide custom field if empty
- Query Product categories what have a custom field
- Custom protected password page with ACF
- Custom column sorting in WordPress admin post table
- Advanced Custom Fields: Sorting custom columns with custom fields sorts only by date
- How to add textarea field to taxonomy (tag)?
- What requirements for ACF custom fields key and name properties?
- Get users based on month ACF datepicker field
- Get value in custom field with taxonomy [closed]
- Remove Category description textarea
- How to remove Profile Picture section or the message “You can change your profile picture on Gravatar.”
- Custom Fields and performance
- WordPress Search documentation: how to improve search query using taxonomy terms, custom meta fields?
- Add field to posts (checkbox) that only one post can have
- generate unique number when registering a user
- How to get value from custom backend menu
- Allow Users to Set Password During Registration
- Auto add taxonomy if post has category
- Get Custom Field Values by Another Custom Field in WordPress
- Passing page url into a custom field via the Press-This bookmarklet
- How to extend nav-menu-item-control data in Appearance > Customize?
- Query posts by category AND custom field, then ORDERBY another custom field – help!
- Loop through custom fields with similar label / common chars in label
- Retrieve value of a category’s custom field
- Custom Taxonomy to dropdown box on adminside wordpress
- How to add contents of a custom field to a taxonomy term list?
- CPT Loop with ACF and passing ID between Loops
- How to change popular term checklist title when edit post?
- Add a date updated/date modified option using custom fields
- How to add an extra button on woocommerce shop page and use it to send the product info with image in a mail? [closed]
- Woocomerce custom billing address fields display in order details [closed]
- 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?
- Redirect to another page using contact form 7? [closed]
- WordPress implode & wp_insert_post question
- Best structure for entering recipes in a WordPress theme?
- How to insert a writing panel between the title and the page content?
- Toggle custom fields?
- Get wordpress taxonomy slug name(s) to use as div class
- How to print Array values of custom Fields Meta?
- What is the best way to modify Admin Panel on WordPress?
- how to make a custom field readonly or disabled by user role?
- How to create “custom page types” with different custom fields in them?
- theme customizer – can a single option pass multiple values?
- Let author add field to metabox by pressing a button
- How to auto add nofollow to links in custom field?
- Get A Custom Field From A Custom Taxonomy Of A Custom Post Type [closed]
- How can I output the custom fields wrapping with HTML
- How do I ensure that post_type and Taxonomy use the same slug?
- Is it possible to add custom badges to product attributes conditionally, based on custom field?
- ACF – Retrieve custom taxonomy from a relationship field
- How to get Previous Visited Page Information
- optimal taxonomy or custom post types
- WordPress category custom title
- No plugin populate user information in to form
- How can Use custom input field in functions.php page?
- Simple custom attributes on posts
- Use a custom page with dynamic content as a user profile page
- ACF unable to use user field
- Can I overwrite custom taxonomy FROM “public” TO “false”
- Display Custom Field or Custom Taxonomy in front page /post/product
- Taxonomy template is not reading
- ACF – Can’t get custom post type by taxonomy
- Upload advanced custom field text link array with csv
- Adding a drop-down (select tag) option under Menu Settings in WordPress Admin
- Remove Custom metabox from particular page template is used
- Replace publish date in blog module with custom field
- ACF Custom field not showing in Timber Taxonomy page
- How do I enable the text editer in my WordPress theme? [closed]
- Style Radio Buttons inside Edit Page (Custom Fields)
- How to add H1 Tag on Homepage?
- Add commentmeta custom field to every published comment with SQL
- Does WordPress support template resources/custom fields
- Change post template the proper way
- ACF Shortcode bringing in my shortcode is adding unnecessary line breaks
- Customize TinyMCE Buttons
- Custom Import with taxonomies
- Add image custom attribute [closed]
- Save And Display Mp3 Audio files on WooCommerce product page with Dokan
- Advice how to connect custom database with WordPress, change data in WordPress and finaly use this data
- Custom Sort Order for Custom Post Type Taxonomy
- Add custom information in editor summary
- Win7 Dev Environment
- Automatically assign a custom post to a custom taxonomy based on custom field value
- Using Custom Function With Advanced Custom Fields
- Advanced Custom Fields query
- Get multiple db prefix with $wpdb
- The Best Way to always load the newest version of 3rd party code
- Edit sticky header html – How to locate corresponding php file
- How do i add custom fields to my themes template file?
- Custom fields issue [closed]
- Applying WP-cli Search & Replace to Static SQL Dump File
- Display custom field from the front page on another page
- Create a Page template selector page
- How Can I limit the visible part of the short-description on the Category page?
- Delete custom fields on post publish?
- Make User Role a Filter
- Changes to code not displaying
- Has the table name in SQL for WordPress changed from WP_posts to WPCS_post?