User Meta Value not echoing despite Var_Dump Showing correct string

The $havemeta variable isn’t defined inside your shopping_location_text() function, so it isn’t available for use there. For a quick fix (or for testing/toying) you can move your code inside the function, like this: add_action( ‘woocommerce_before_main_content’, ‘shopping_location_text’, 10 ); function shopping_location_text() { global $current_user; get_currentuserinfo(); // wordpress global variable to fetch logged in user info $userID … Read more

Check if searched number is within the post meta value

Assuming your “property-guests” taxonomies have names like “1”, “2”, “3”, etc.: <?php // Get the number of guests the visitor searched for $requiredGuests = $_POST[‘guests’]; // Get all terms in the “property-guests” taxonomy // (By default, this will only include terms that are assigned to something) $allGuestNumbers = get_terms(array(‘taxonomy’ => ‘property-guests’)); // Create a variable … Read more

Set both meta_query and tax_query using wp_query->set

Just use another set() method: if ($value[‘pRange’] && $value[‘tags’]) { $wp_query->set(‘tax_query’, array( ‘relation’ => ‘OR’, array( ‘taxonomy’ => ‘product_tag’, ‘field’ => ‘slug’, ‘terms’ => $value[‘tags’], ), array( ‘taxonomy’ => ‘product_cat’, ‘field’ => ‘slug’, ‘terms’ => $value[‘tags’], ), array( ‘taxonomy’ => ‘pa_branding’, ‘field’ => ‘slug’, ‘terms’ => $value[‘tags’], ), ) ); $wp_query->set(‘meta_query’, array( ‘relation’ => ‘AND’, … Read more

get_users with array as meta_value

First, can use meta_query, but, you should change your values to use the proper date format, e.g. 2020/01/02 for January 2nd, rather than a regional format. See https://en.wikipedia.org/wiki/ISO_8601 for more details. Second, your LIKE query is going to be very expensive, and achieving what you want while still using a LIKE query will be even … Read more

Order by meta_key doesn’t work

Current Query $args = array( ‘post_type’ => ‘brands’, ‘meta_query’ => array( array( ‘key’ => ‘br_type’, ‘value’ => ‘Aviation’ ), array( ‘key’ => ‘br_category’ ), array( ‘key’ => ‘br_name’ ) ), ‘posts_per_page’ => -1, ‘orderby’ => [ ‘br_category’ => ‘ASC’, ‘br_name’ => ‘ASC’ ], ‘order’ => ‘ASC’, ‘fields’ => ‘ids’ ); produce this SQL query ‘SELECT … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)