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);

How to get string from add_theme_support(‘title-tag’) for meta tag and beautify?

I don’t have a good way to query a title string to fill in the content You can use wp_get_document_title() to get the document title. So for example in your case: (see the docs for details on esc_attr()) <?php // Put the title (string) in a variable. $title_esc = esc_attr( wp_get_document_title() ); ?> <meta property=’og:title’ … Read more

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