$config ) { if ( empty( $config['fields']['description'] ) ) { continue; } add_meta_box( 'mfs-description', __( 'Description', 'mapfield-spots' ), array( $this, 'render_description' ), CPT::post_type_slug( $slug ), 'normal', 'high' ); } } public function render_description( \WP_Post $post ): void { wp_nonce_field( self::NONCE_ACTION, self::NONCE_NAME ); wp_editor( $post->post_content, 'content', array( 'textarea_name' => 'content', // keeps core's post_content save logic 'media_buttons' => false, 'teeny' => false, 'textarea_rows' => 12, 'tinymce' => array( 'content_css' => MAPFIELD_SPOTS_URL . 'assets/editor-content.css', ), ) ); } public function save( int $post_id ): void { $nonce = isset( $_POST[ self::NONCE_NAME ] ) ? sanitize_text_field( wp_unslash( $_POST[ self::NONCE_NAME ] ) ) : ''; if ( ! wp_verify_nonce( $nonce, self::NONCE_ACTION ) ) { return; } if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } if ( ! current_user_can( 'edit_post', $post_id ) ) { return; } // Nothing to save here yet; nonce/hook stay ready for a future field. } }