Meta Query
meta_query takes an array of meta query arguments arrays. You may check WordPress documentation for examples.
This construct allows you to query multiple metadatas by using the relation parameter in the first (outer) array to describe the boolean relationship between the meta queries. Accepted arguments are ‘AND’, ‘OR’. The default is ‘AND’.
Solution
$loop = new WP_Query( [
'post_type' => 'studio',
'posts_per_page' => -1,
'post_status' => 'publish',
// meta_query argument is an array of one or many meta query arrays,
even if you have just a single meta query
'meta_query' => array(
array(
'key' => 'kk-zuschuss',
'value' => 'ja',
'compare' => 'LIKE',
),
),
'meta_key' => 'name_teacher',
'orderby' => 'meta_value',
'order' => 'ASC',
] );
Related Posts:
- Show only one post for each author ( Page loads too slow )
- Modern Tribe Calendar wp-query with meta query not working at all
- if statement on database query
- Looking for most performant way to execute several similar WP queries within shortcodes
- Why is variable not working on custom sql query using wpdb?
- How to securely provide a $_POST var in WP_Query with PHP 7?
- Create WP_Query to search for posts by their categories or their parent/child categories
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- get_posts() and WP_query limits ‘AND’ conditions to a maximum of 6 for meta value queries in WordPress
- inserting a post from an extern php file but post content doesn’t show on wp site
- Hide posts if user is added to it WP_query
- Custom route and query
- WordPress WP_Query without query GET parameters
- How to WP_Query posts order by parent title?
- Passing in MySQL prepare statement parameter separately throwing error
- Usermeta data unserialize, extract and display in table in WordPress
- how to get data from two different table from wordpress database
- Query doesn’t display text data with apostrophes
- SQL Query Search page
- How can I display a query in a page?
- Custom query_posts() parameter
- Execute multiple PHP Snippets causes error?
- How to get the list of WooCommerce product image of a certain category from database?
- retrieve thumbnail from post ID of best selling product in category
- Changing user_nicename
- WordPress will not operate correctly
- How to create a WP_Query to search the Title or Tag?
- tag search using WP_Query
- Your PHP installation appears to be missing the MySQL extension which is required by WordPress
- Is the regular ajax request method safe or I should use admin-ajax.php?
- Sortable admin column for one meta key with three possible meta values
- WP_Query meta_query results date by date
- WordPress Ajax Custom Query – High CPU LOAD
- Help with adding pagination to custom wp_query
- AJAX in WordPress, sending coords data to MySQL and show after into map
- Styling images coming from another blog
- API response to be stored locally
- How to convert objects into arrays
- Ajax $wpdb not returning table data
- Is there a way to get 3+ dimensional array from a single MySql command
- have_posts() execution failure
- How to filter posts by post format “standard” from wp-json api?
- Can’t search posts using WP_QUERY inside AJAX Function
- How can I use wp_query to show all product data using just the products ID?
- Can’t get wp_insert_post to work
- mysql query from wordpress page using custom table
- Importing Geo data into wordpress database
- PHP Fatal error: Uncaught mysqli_sql_exception: Table doesn’t exist in wordpress/wp-includes/wp-db.php
- How to check if a meta value has already been assigned to any user?
- Loading the same WP_Query in two different wordpress .php templates
- How to prevent WP_Query function from returning all posts when empty?
- Exclude posts with specific metadata from search?
- Force Users To Relogin
- email alert for product availability
- Basic wpdb update question
- A $_POST should occur when submit form but is not?
- change the default order of posts only for specific categories
- Pull MySQL data from multiple tables and merge into 1 PHP array
- extract serialized array to use for wp-query
- Using CFDB7 vs Custom MySQL Database [closed]
- Order a WP_Query by meta value where the value is an array
- Adding data to custom wordpress database table
- select a single val though a table in wordpress
- populate select options from extra mysql table data
- Removal of all posts content in bulk, keeping the posts itself
- Let current user know pending posts counts using wp_query
- get_terms with specific id order
- How to store checkbox data for individual users?
- “pre_get_posts” orderby custom date field in different format?
- wp_query – Exclude the first thumbnail from lazy loading on archives
- Query on a repeater date (acf)
- I can’t separate the array by commas
- Trying to get pagination working on WP_Query() post grid
- Check the database for a postmeta field
- How can i limit the number of posts to the most recent 6 in my query?
- Combine multiple queries, array_unique returns nothing
- wordpress query returning unexpected results
- Custom Post type Ajax search results
- (Who to follow) Twitter widget
- Display only upcoming events / Show all events when archive year is selected
- Transfer WordPress Login Session to an Extended Webpage on the Same Domain
- Add post class in custom loop (WP_QUERY)
- How to properly send many mysql queries via php and what happens with ajax requests after they are sent?
- Passed variable gets undefined variable error on insert on next page
- How to set up an auto delete post?
- Why does WP_Query show only the same post even with different categories and endwhile?
- show/hide attachments
- MySQL update text field with ‘
- WP_Query based on another query on the page
- Show post like this image in my newssite [closed]
- Changing regular db connection to $wpdb
- How to get a database field value from a WordPress table? [closed]
- XML WP_Query problem in PHP 8.0 and 8.1
- Error resetting database index using ALTER TABLE in $wpdb->query
- How do I display WooCommerce products in my query to rows of 3?
- Can’t insert into a database wordpress
- How to get posts by a certain author in inner loop using outer loop variable or post title WordPress
- AND and OR in my CPT search query depending on checkbox
- How can I save the HTML output of a WP_Query function as a variable?
- How do I use fields => ids in an array with WP Query?