I have a wordpress theme, where in the posts I have some metabox custom.
By moving the post to the recycle bin and retrieving it again, it does not return with the metabox values filled in
What can it be?
I have a wordpress theme, where in the posts I have some metabox custom.
By moving the post to the recycle bin and retrieving it again, it does not return with the metabox values filled in
What can it be?
You're experiencing the same issue described in this question (in English).
It is probably a bug in the theme caused because the save_post
function is called without the post data when the article is sent to the recycle bin.
As described in the link above, the solution is to add a condition in the save function to not save the metadata in this case.
Example extracted from the link, which you should adapt in your theme:
function wpg_save_testimonial_author($post_id) {
global $post;
if (!wp_verify_nonce($_POST['testimonial_author_noncename'], plugin_basename(__FILE__).$post->ID)) {
return $post->ID;
}
if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return $post_id;
}
if(defined('DOING_AJAX')) {
return;
}
if(!current_user_can('edit_post')) {
return $post->ID;
}
if($post->post_type == 'revision') {
return;
}
update_post_meta($post->ID, 'testimonial_author_name', $_POST['testimonial_author_name']);
update_post_meta($post->ID, 'testimonial_author_link', $_POST['testimonial_author_link']);
}
add_action('save_post', 'wpg_save_testimonial_author');