You should be able to do this with WP_Query‘s meta_query parameters:
$type="something";
$programme="another";
$args = array(
'meta_query' => array(
array(
'key' => 'type',
'value' => $type,
'compare' => '='
),
array(
'key' => 'programme',
'value' => $programme,
'compare' => 'LIKE'
)
)
);
$query = new WP_Query( $args );
Related Posts:
- How to rename a custom field?
- Custom Field Create Bulk via SQL Query
- searching by keywords in post’s metas or pagination links problem
- SQL Query to copy value of a meta_key into another meta_key
- How to correctly call custom field dates into a posts_where filter using SQL statements
- Add custom fields to search
- SELECT max(meta_value) FROM wp_postmeta WHERE meta_key=’price’… stops working when value is over 999
- How can I make wp-pagenavi work on a custom query built upon a form submission? [closed]
- Meta Query with AND & OR?
- Bulk move (or copy) from a custom field to the post content?
- Up/Down voting system for WordPress
- Custom Fields Bulk Edit
- Plugin similar to Taxonomy Drill-Down for custom fields?
- How do I query for a post by custom field?
- Count how many posts have a custom field set
- Upcoming Event: How do I sort database by custom date field, but ignore past dates?
- sort search results by custom fields using dropdown
- Get all posts that do not have a specific custom field without using a subquery
- How can I sort homepage by a meta value?
- Loop to display random posts only if a custom field matches category
- Conditional custom field query
- Order query by meta_value with multiple custom fields
- Display only past events on that page using Visual Composer Grid Bulider
- Create Pop-Up Box with Custom Field Content Inside the Loop
- query usermeta from custom field
- Is there any way to get all meta and standard columns for any WordPress object after searching based on meta key and value
- Order RSS content by an advanced custom field value
- UPDATE on SELECT results. A SQL query to swap Author with Meta Box value
- Alter main archive, to show posts with meta as last
- Meta Query And/Or
- Trying to reorder posts by custom field
- Limits, not all post are showen when querying for posts by view count
- Why orderbyb meta_value_num won’t affect the generated SQL Query order?
- Get post ids sorted by meta_key
- querying a custom field
- pre_get_posts : only get posts by wp_usermeta value
- Query post by date (stored custom field meta as yyyymmdd) and differentiate across 12 months
- How to query an out put value?
- List custom queried terms in the edit-tags.php?taxonomy page
- Modify date query by URL parameter using pre_get_posts and $_GET
- Get emails from users by custom field SQL
- Loop through incrementing custom fields
- Custom search SQL Query to add custom field in result
- The best way to collision check in WP
- SQL: Select wordpress posts with given text string and add a custom field to them?
- How to exclude custom fields from search queries?
- WP_Query () using taxonomy, custom post types
- Show array of meta_value in Edit Post Coloum
- How to query for posts with either one or another custom field
- Best way to sort estates and query them (for rent? yes/no. contains office space? yes/no)?
- Custom Query: query by post custom meta data
- Get array of posts based on custom field values
- Searching with Multiple (Parallel) Criteria on Custom Fields?
- How to query posts by month based on date custom field?
- Custom Field Date Problem
- Compare ACF date field (if exists) and post date and order DESC
- Change word in woocommerce product category custom field
- Problem with revisions only returning four results
- Search & column order by meta value in admin
- Dynamically populate query source in Elementor post widget
- SQL query to change the value of a Custom Field
- select user with all meta field and field value. I am use Below Query for this ,So any of know another way to fast query instead of below query?
- Create custom query for search?
- Convert all dates in field to Unix time, except those already in Unix time
- Meta_query not filtering posts
- Get multiple posts with some custom fields efficient
- How to add a prefix to existing custom fields over MYSQL query?
- Complex WP_Query Using Post Date And Post Meta
- Alter SQL query to return posts with unique custom field value, no duplicate values
- How to check if custom field exists in this widget query
- Only show content slideshow if “slideshow” custom field exists
- Update field name without losing the value
- How to display search query as formatted text?
- Is there a way to list all used/unused WP templates?
- SQL query equivalent to WP User Query
- Add custom field to image editor
- ajax delete value from custom field array
- How can I sort get_users() by any value (last_name, user defined fields and more)
- Custom field for default gallery
- WordPress Custom Field Should be Unique. Is it possible?
- all tincymce’s switch when updating page after changing from html to text in custom metabox
- List custom taxonomy terms from custom field
- How do I create a column in Users list and display user data from custom registration field
- Product Custom Fields with HTML and JS
- Add new image block, set default class name and update it using Javascript
- Delete custom fields when deleting posts
- Sortable custom field values from all posts on a page template
- Values entered in a meta box aren’t saved
- Display meta box dropdown (from custom post type) in the page post type
- how can I show name and value of Custom Fields together?
- Adding simple (one button) Audio player using Custom Fields?
- Why my query does not run with prepare
- Display metabox title for custom fields with values
- Any way to use FETCH_KEY_PAIR with $wpdb?
- Search one custom field?
- Can’t save meta field value if the title not set
- Why is wp_list_pages altering $post->ID of the page?
- How to keep sharing stats after creating 301 redirects?
- Use custom field value as href
- Where can I find the SQL to get the most used information by wordpress database?