Custom wp_editor not saving
-
Hi, I have the following code, which works on an old 4.8 WP installation (without “Disable Gutenberg” installed, of course) but doesn’t seem to on 5.1.1 with the plugin installed. Has the back-end API changed in such a way wp_editor() is unusable?
public function show_example_field_metabox() { global $post; wp_nonce_field(basename(__FILE__), 'example_field_nonce'); $value = get_post_meta($post->ID, 'example_field', true); $settings = array('wpautop' => false, 'textarea_name' => 'example_field', 'textarea_rows' => 10); wp_editor(htmlspecialchars_decode($value), 'example_field', $settings); } public function save_example_field_metabox($post_id) { if (isset($_POST['example_field'])) { update_post_meta( $post_id, 'example_field', htmlspecialchars($_POST['example_field']) ); } else { delete_post_meta($post_id, 'example_field'); } } add_action('add_meta_boxes', 'add_example_field_metabox'); add_action('save_post', 'save_example_field_metabox');
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Custom wp_editor not saving’ is closed to new replies.