metabox displaying on incorrect page

Dropping the code quickly into my test set up, I think you are asking why your page metabox is showing your desired post meta inputs. There’s no problem with your add_meta_box() functions. The problem is with your variable $custom_meta_fields. By the time WordPress gets to the end of your file $custom_meta_fields is defined by the … Read more

How to change data format in custom meta box field [closed]

EDIT You should be using date_create_from_format or its alias DateTime::createFromFormat() to convert on format to another. You can try the following $date = DateTime::createFromFormat(‘m-d-Y’, ’03-09-2015′); echo $date->format(‘d-m-Y’); This will convert 03-09-2015 to 09-03-2015 ORIGINAL ANSWER This is more a PHP question than WordPress question. You can simply use str_replace to change the / in your … Read more

Issues on saving data from CPT select metabox

I got the answer. Now I have the code function fichasvtmbasicas_meta_box_callback( $post ) { wp_nonce_field( ‘fichasvtmbasicas_meta_box’, ‘fichasvtmbasicas_meta_box_nonce’ ); $fichasvtmbasicas_geracao_field = get_post_meta( $post->ID, ‘_vtmbasica_geracao_value_key’, true ); echo ‘<div class=”unidadeelementotopovtm”><label for=”fichasvtmbasicas_geracao_field” class=”topodaficha_titles”>’; _e( ‘Geração:’, ‘fichasvtmbasicas_textdomain’ ); echo ‘</label> ‘; echo ‘<select id=”fichasvtmbasicas_geracao_field” name=”fichasvtmbasicas_geracao_field”>’; echo ‘<option value=”decima-quinta” ‘ . selected( $fichasvtmbasicas_geracao_field, ‘decima-quinta’ ) . ‘>15ª</option>’; echo ‘<option value=”decima-quarta” … Read more

send meta box input data without publish button

You can get the post id like this var post_id = $(‘input[name=”post_ID”]’).val(); See this full working code. BTW its only save the value to the meta in the ajax it won’t save it on the publish button you need to add another hook with another function. you can’t use the same function that you used … Read more