Cannot save underscore custom fields in one wordpress installation using xmlrpc and underscores

You have to unprotect meta to be able to access it with XML-RPC: <?php function my_unprotect_meta( $protected, $meta_key, $meta_type ) { if( ‘_al_listing_price’ == $meta_key ) { return false; } } add_filter( ‘is_protected_meta’, ‘my_unprotect_meta’, 10, 3 ); The solution you’ve mentioned in the comment to the question is ‘duct tape’ though it works. It completely … Read more

Is it possible to populate a custom field with content from a page

You can see https://codex.wordpress.org/Plugin_API/Action_Reference/save_post for reference. Here is a quick example of creating/updating meta field when create/updating a page. function save_page( $post_id, $post, $update ) { $post_type = get_post_type( $post_id ); // If this isn’t a ‘page’ post, don’t update it. if ( ‘page’ != $post_type ) return; // Update the post’s metadata. update_post_meta( $post_id, … Read more

Custom Field Repeating When Using foreach

if you want to use multiple users, if you will add usernames comma separated in custom field. try below code. function user_avatar() { $user = “”; $names = get_post_meta( get_the_ID(), ‘user_name’, true ); $user_names = array_map(‘trim’, explode(‘,’, $names)); if(!empty($user_names)) { foreach ($user_names as $key => $user_name) { $user = get_user_by( ‘login’, $user_name ); if($user) { … Read more

Values entered in a meta box aren’t saved

You have to remove if($post_slug != $post->post_type){} from save function or change $post_slug = “book”; to $post_slug = “page”;. because it check $post slug is book or not. currently post type is page for contact us page. and you have set as book add_action(“save_post” , “wpl_owt_save_metabox_data” , 10 , 2); function wpl_owt_save_metabox_data($post_id, $post){ //verify nonce … Read more