| @@ -36,17 +36,22 @@ | ||
| 36 | 36 | $value = ! $meta && ! empty( $this->default ) ? $this->default : $meta; |
| 37 | 37 | $value = $extra['value'] ?? $value; |
| 38 | 38 | $desc_tip = $extra['desc_tip'] ?? ''; |
| 39 | 39 | |
| 40 | - echo '<div class="lp-meta-box__wp-editor form-field ' . esc_attr( $this->id . '_field ' . $wrapper_class ) . '"> | |
| 41 | - <label for="' . esc_attr( $this->id ) . '">' . wp_kses_post( $this->label ) . '</label>'; | |
| 40 | + printf( | |
| 41 | + '<div class="lp-meta-box__wp-editor form-field %s"><label for="%s">%s</label>', | |
| 42 | + esc_attr( $this->id . '_field ' . $wrapper_class ), | |
| 43 | + esc_attr( $this->id ), | |
| 44 | + wp_kses_post( $this->label ) | |
| 45 | + ); | |
| 42 | 46 | |
| 43 | - echo wp_editor( | |
| 47 | + wp_editor( | |
| 44 | 48 | $value, |
| 45 | - $this->id, | |
| 49 | + sanitize_key( $this->id ), | |
| 46 | 50 | array( |
| 47 | 51 | 'textarea_rows' => 10, |
| 48 | 52 | 'editor_class' => 'lp-meta-box__wp-editor__textarea', |
| 53 | + 'textarea_name' => $this->id, | |
| 49 | 54 | ) |
| 50 | 55 | ); |
| 51 | 56 | |
| 52 | 57 | if ( ! empty( $this->description ) ) { |
| @@ -61,9 +66,11 @@ | ||
| 61 | 66 | echo '</div>'; |
| 62 | 67 | } |
| 63 | 68 | |
| 64 | 69 | public function save( $post_id ) { |
| 65 | - $meta_value = isset( $_POST[ $this->id ] ) ? wpautop( wp_unslash( $_POST[ $this->id ] ) ) : $this->default; | |
| 70 | + $meta_value = LP_Request::get_param( $this->id, $this->default ?? '', 'html' ); | |
| 66 | 71 | |
| 67 | 72 | update_post_meta( $post_id, $this->id, $meta_value ); |
| 73 | + | |
| 74 | + return $meta_value; | |
| 68 | 75 | } |
| 69 | 76 | } |