copy the Value from one Meta to another Meta

If you just need get_post_meta( $post_id, ‘ywbc_barcode_display_value_custom_field’, $single ); to return the value that’s stored in ean, you can filter the get_post_meta() call to return that value: add_filter( ‘get_post_metadata’, ‘wpse424858_filter_meta_value’, 10, 4 ); /** * Filters the barcode display meta value. * * @param mixed $value The existing meta value. * @param int $id The … Read more

Get meta value based on user id

get_users is for retrieving users, not meta. To get the user meta of a user where $user_id is that users ID, you can use get_user_meta and it should work the same as the other meta functions: $meta_value = get_user_meta( $user_id, ‘the meta key’, true ); You can use $user_id = get_current_user_id(); to retrieve the ID … Read more

Order by meta_key where value is serialized

Yes, it is possible, however your question is not really precise. What you experience is probably already that it is possible to sort by meta_key even the value of it is a string of some serialized data – it’s just that this is the standard binary sort and WordPress does not take care about that … Read more

Multiple Meta_values

$args = array( “numberposts” => -1, ‘post_type’ => ‘page’, ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => ‘page_type’, ‘value’ => 1, ‘compare’ => ‘=’ ), array( ‘key’ => ‘page_type’, ‘value’ => 3, ‘compare’ => ‘=’ ) ) ); $city_ids = get_posts($args);

Autoprediction / Autocomplete Search with Meta Keys

If you want to show custom field values, you can’t use WP_Query that select posts. It seems to me that the only available way is to write a sql query and execute it in $wpdb. global $wpdb; if ( isset($_POST[‘search’]) == false || empty($_POST[‘search’]) ) wp_send_json_success( $array() ); $s = $_POST[‘search’]; $meta_keys = [‘PLZ’, ‘ort’, … Read more

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

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