Problem with update_user_meta() meta_value

I fixed it doing like below: $meta_value = //data from an API (e.g.: 19, 34, 1290 etc) $meta_value_string = “”. $meta_value; $user_id = wp_insert_user( $new_user_data ); update_user_meta( $user_id, ‘my_meta_key’, $meta_value_string ); Now it works fine.

Can’t sort custom column on user.php by number / meta_value_num?

Instead of ‘request’ function, use this : add_action(‘pre_user_query’, ‘user_column_orderby’); function user_column_orderby($userquery){ if(‘Votes’==$userquery->query_vars[‘orderby’]) { global $wpdb; $userquery->query_from .= ” LEFT OUTER JOIN $wpdb->usermeta AS alias ON ($wpdb- >users.ID = alias.user_id) “; $userquery->query_where .= ” AND alias.meta_key = ‘wp__user_like_count’ “; $userquery->query_orderby = ” ORDER BY alias.meta_value “.($userquery->query_vars[“order”] == “ASC” ? “asc ” : “desc “); } }

Update another users meta

wp_ajax_nopriv_{$action} can trigger a non-logged in ajax request. add_action( ‘wp_ajax_nopriv_add_foobar’, ‘prefix_ajax_add_foobar’ ); function prefix_ajax_add_foobar() { // Handle request then generate response using WP_Ajax_Response } get_user_by can pull the user’s data via email $user = get_user_by(’email’, ‘[email protected]’) update_user_meta can update the user’s metadata. update_user_meta( $user->ID, $meta_key, $meta_value, $prev_value );

Save multiple checkboxes with Types

Remove apply_filters() and just pass the array values into your wp_insert_user: array( ‘first_name’ => $nombre, ‘last_name’ => $apellidos, ‘user_pass’ => $contrasena, ‘user_login’ => $username, ‘user_email’ => $email, ‘role’ => ‘subscriber’, ) WordPress already managed those apply_filters, so there’s no reason to use them in your code. Hope it helps! Me dices si te sirvió, también … Read more

Custom user meta values in shortcode

You didn’t mention whether users could only reach this page when logged in, so this example includes a check to make sure the current visitor is logged in, otherwise it won’t output anything. <?php // create the shortcode add_shortcode(‘wpse_312268_show_cc_info’, ‘create_wpse_312268_shortcode’); function create_wpse_312268_shortcode() { // only do something if user is logged in if(is_user_logged_in()) { // … Read more

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