Migrating from metaboxes to wp_editor()

It works just the same like a regular textarea with the exception of the data being escaped so when you call for the saved data just make sure to decode the html entities using html_entity_decode here is a very simple demo class, take a look at how the field is created. if (!class_exists(‘wp_editor_meta_box’)){ class wp_editor_meta_box{ … Read more

‘save_post’ hook not working in WP 3.5

attachment_fields_to_save is still called. Just tried out this on my wordpress 3.5. installation and the following code killed wordpress when saving an image. add_filter(‘attachment_fields_to_save’, function() { die(‘attachment_fields_to_save’); });

where does this $post_id come from?

It comes from wp_insert_post(), where do_action() is called with two additional parameters: do_action(‘save_post’, $post_ID, $post); So it is not you who adds the parameters, it is WordPress. If you register your callback with the fourth parameter set to 2 … add_action( ‘save_post’, ‘mytestfunc’, 10, 2 ); … you will even get the complete $post object: … Read more

Custom metabox not displaying multiselect data in edit mode

I tested your code and this ended up working for me: case ‘multiselect’: echo ‘<select name=”‘.$field[‘id’].'” id=”‘.$field[‘id’].'”>’; foreach ($field[‘options’] as $option) { echo ‘<option’, $meta == $option[‘value’] ? ‘ selected=”selected”‘ : ”, ‘ value=”‘.$option[‘value’].'”>’.$option[‘label’].'</option>’; } echo ‘</select><br /><span class=”description”>’.$field[‘desc’].'</span>’; break; For the Field Array I just added another option with a blank value and a … Read more

Why does not my metabox save?

I notice a couple of things. First, your callback uses two parameters but you don’t ask for the second parameter when you hook it in. This: add_action( ‘save_post’, ‘kasparibi_left_menu_meta_save’ ); Should be: add_action( ‘save_post’, ‘kasparibi_left_menu_meta_save’ ,1 ,2 ); But, on the other hand, I don’t see where you use that parameter at all. Maybe I … Read more

Can’t Get Metabox Data Saved Assistance Needed

The save_post hook is the only one you need, also, your callback function is missing a parameter, check this example: /** * Save post metadata when a post is saved. * * @param int $post_id The ID of the post. */ function save_book_meta( $post_id ) { /* * In production code, $slug should be set … Read more