Adding an array from a query string to a WP meta_query

This $_GET[‘variable’] is an array, as per your URL query string ?variable[]=value1&variable[]=value2, $_GET[‘variable’][0] and $_GET[‘variable’][1] should return those 2 key values Edit – after the discussion – making it dynamic $meta_query = array(); if ( ! empty( $_GET[“variable”] ) ) { if ( is_array( $_GET[“variable”] ) ) { $meta_query[‘relation’] = ‘OR’; foreach ( $_GET[“variable”] as … Read more

Script Localization doesn’t work

Copying from the answer here regarding variable scope Variables inside a function are only available inside that function. Variables outside of functions are available anywhere outside of functions, but not inside any function. Because of that, you need to add your $translations array within the kvkoolitus_load_comment_validation function, like function kvkoolitus_load_comment_validation(){ $translations = array( ‘value1’ =>’This … Read more

How can I add multiple ‘tax_query’ arrays via a loop?

OK, I have no idea how and why your code should work… It has nothing in common with correct PHP syntax… But it’s pretty good pseudo-code, so I think I can guess, what you wanted to achieve… $tax_query = array(); if ( have_rows(‘category_taxonomies’) ) { while ( have_rows(‘category_taxonomies’) ) { the_row(); $tax_query[] = array( ‘taxonomy’ … Read more

Remove duplicates – array_unique()

I was able to answer my question thanks to : https://wpquestions.com/Remove_duplicates_from_ACF_query/12685 <?php $posts = get_posts(array( ‘numberposts’ => -1, ‘post_type’ => ‘page’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’, )); if($posts) { /* FIRST, get all the post data */ foreach($posts as $post) { /* SECOND, one-by-one, add each data row for the specific field into an … Read more