meta_query with multiple key

key in a meta query needs to be a string, you can’t pass multiple keys to a single meta query. You’ll need add a query for each key: $filter = array( ‘post_type’ => ‘request’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => $key1, ‘value’ => $search_value, ‘compare’ => … Read more

wordpress Meta_query between numbers range (not working)

you can use meta query operators like below query. See docs for meta_query parameters here $range = $_GET[‘range’]; // assuming you get the range from query string parameter which 11-19 $range_array = explode(‘-‘,$range); $args = array( ‘post_type’ => ‘YOUR-POST-TYPE’, ‘meta_query’ => array( array( ‘key’ => ‘sizes_avaliable’, ‘value’ => $range_array, ‘compare’ => ‘BETWEEN’ ), ) ); … Read more

Is it possible to query a custom field where the value is between two fields?

I think it is pretty simple. I got the reference from here: https://www.advancedcustomfields.com/resources/query-posts-custom-fields/ $findNumber = 150; $args = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘photos-videos’, ‘meta_query’ => array( ‘relation’ => ‘AND’, array( ‘key’ => ‘max_number’, ‘value’ => $findNumber, ‘type’ => ‘NUMERIC’, ‘compare’ => ‘>=’ ), array( ‘key’ => ‘min_number’, ‘value’ => $findNumber, ‘type’ => ‘NUMERIC’, … Read more

Custom loop not working

Try this: $args = array( ‘post_type’=> ‘televisie’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 5, ‘meta_key’ => ‘layout_meta_box’, ‘meta_value’ => ‘synopsis’, ); A helpful article too: https://css-tricks.com/snippets/wordpress/custom-loop-based-on-custom-fields/

Omit custom post type from wp-sitemap.xml based on meta key using wp_sitemaps_posts_query_args

The error happens because the filter callback (shapeSpace_disable_sitemap_post_meta()) expects to receive two parameters ($args and $post_type) and yet you call add_filter() without setting the fourth parameter to 2. So to solve the problem: // Replace this: add_filter(‘wp_sitemaps_posts_query_args’, ‘shapeSpace_disable_sitemap_post_meta’); // with this one: add_filter(‘wp_sitemaps_posts_query_args’, ‘shapeSpace_disable_sitemap_post_meta’, 10, 2);