How to get user_meta value for new user regsitered?

Read de Codex entry for user_register action, it says: Not all user meta data has been stored in the database when this action is triggered. Note that doing: $user = wp_insert_user( $userdata ); update_user_meta( $user, ‘companyId’, 350 ); Follow this sequence: insert user -> run user_register action -> rung your update user meta function. So, … Read more

get_pages sort alphabetically by meta value

The get_pages function is rather old and really shouldn’t be used anymore. Use a get_posts instead (a Page is just a special type of Post): $listingPages = get_posts( array( ‘meta_key’ => ‘streetAdd’, ‘post_type’ => ‘page’, ‘post_status’ => ‘publish’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’, ) );

WP_Query with meta_value LIKE ‘something%’

For a left-sided match you can get around the automatic adding of ‘%’‘s by WP by using regular expression RLIKE: ‘meta_value’ => ‘^’ . preg_quote( $today ), ‘meta_compare’ => ‘RLIKE’ Similarly for right-sided match: ‘meta_value’ => preg_quote( $today ) . ‘$’, ‘meta_compare’ => ‘RLIKE’

How can I display all values of a custom field from posts with a certain value of another custom field or from certain post types?

take a look at the reference docs for the WP_Query class: http://codex.wordpress.org/Class_Reference/WP_Query something like this: $args = array( //some key/value pairs…whatever ‘meta_query => array( array( ‘key’ => somekey, ‘value’ => somevalue, ‘compare’ => some comparison operator ), array( ‘key’ => some other key, ‘value’ => some other value, ‘compare’ => some comparison operator ) ) … Read more

Is it possible to orderby multiple meta_keys when using meta_value_num?

You might want to check out the query improvements in WP 4.2 for ‘orderby’ and ‘meta_query’. Details are on https://make.wordpress.org/core/2015/03/30/query-improvements-in-wp-4-2-orderby-and-meta_query. Try to name your meta_query clauses, then order by them. Following code is untested: $query = array( ‘order’ => ‘DESC’, ‘meta_query’ => array( ‘relation’ => ‘OR’, ‘cat1-clause’ => array( ‘key’ => ‘cat1’, ‘type’ => ‘numeric’ … Read more

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