WP_Query: How to get results from both meta_key options?

You can put your meta_query in a variable to achieve the desired result. Then you can fill the variable with your actual meta_query when your condition is met. Check out the code below. $meta_query = array(); if ( isset($_GET[‘scope’]) && !empty($_GET[‘scope’]) ) { $meta_query[] = array( ‘key’ => ‘name’, ‘value’ => $_GET[‘scope’], ‘compare’ => ‘=’ … Read more

How to set variables with AJAX request to use in another function in WordPress

There are two issues Broken Callbacks You’ve used: add_action(‘wp_ajax_nopriv_my_php_ajax_function’,’my_php_ajax_function’ ); This is equivalent to: When `wp_ajax_nopriv_my_php_ajax_function` happens do: `my_php_ajax_function()` Which is not what you wanted, because that is not a function, and there is no my_php_ajax_function function. You also don’t just want it on that class, you want it on that specific instance of that … Read more