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

Input select option Change Content in Metabox

This is totally wrong. Metaboxes are shown on post/page editing screen, so if you submit your own form, the whole page will be submitted/refreshed. Look up what a metabox is here => SO Thread You should use WP’s own functions to deal with this. Look add_meta_box() and check this tutorial to know how you should … Read more

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