Order posts base on last favorite post by user

To order favorite posts based on the last post favorited by a user, you need to modify the query to include the post IDs in the order they were favorited by the user WP does not directly store the order of favorites, you might need to store this information separately, for example, in user meta … Read more

WP Query: orderby with one meta key, but multiple values

Use this code instead- $supplierArgs = array( ‘post_type’ => ‘service_providers’, ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => ‘service_provider_tier’, ‘value’ => ‘G’, ‘compare’ => ‘=’ ), array( ‘key’ => ‘service_provider_tier’, ‘value’ => ‘S’, ‘compare’ => ‘=’ ), array( ‘key’ => ‘service_provider_tier’, ‘value’ => ‘B’, ‘compare’ => ‘=’ ), ), ‘orderby’ => ‘meta_value’, ‘meta_key’ => … Read more

Meta query with ACF relationship field

Based on https://stackoverflow.com/questions/42011047/wordpress-query-by-acf-relationship-field, I was able to fix this by changing the ‘compare’ => ‘IN’ to ‘compare’ => ‘LIKE’. So the resultant code looks like this: $new_query_args = [ ‘meta_query’ => [ [ ‘key’ => ‘af_author’, ‘value’ => get_the_ID(), ‘compare’ => ‘LIKE’, ] ] ]; $query_args = array_merge( $query_args, $new_query_args ); I’m not exactly sure … Read more

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