| @@ -7,10 +7,10 @@ | ||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Registers a metabox on Posts, Pages and public facing Custom Post Types |
| 11 | - * that do not use the block editor, saving settings when the Post is saved | |
| 12 | - * in the WordPress Administration interface. | |
| 11 | + * and saves its settings when the Post is saved in the WordPress Administration | |
| 12 | + * interface. | |
| 13 | 13 | * |
| 14 | 14 | * @package ConvertKit |
| 15 | 15 | * @author ConvertKit |
| 16 | 16 | */ |
| @@ -26,9 +26,9 @@ | ||
| 26 | 26 | // Register "Add New" Kit button on Pages. |
| 27 | 27 | add_filter( 'views_edit-page', array( $this, 'output_wp_list_table_buttons' ) ); |
| 28 | 28 | |
| 29 | 29 | add_action( 'post_submitbox_misc_actions', array( $this, 'output_pre_publish_actions' ) ); |
| 30 | - add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 10, 2 ); | |
| 30 | + add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) ); | |
| 31 | 31 | add_action( 'save_post', array( $this, 'save_post_meta' ) ); |
| 32 | 32 | |
| 33 | 33 | } |
| 34 | 34 | |
| @@ -180,12 +180,11 @@ | ||
| 180 | 180 | * Adds a meta box for the given Post Type. |
| 181 | 181 | * |
| 182 | 182 | * @since 1.9.6 |
| 183 | 183 | * |
| 184 | - * @param string $post_type Post Type. | |
| 185 | - * @param WP_Post $post Post. | |
| 184 | + * @param string $post_type Post Type. | |
| 186 | 185 | */ |
| 187 | - public function add_meta_boxes( $post_type, $post ) { | |
| 186 | + public function add_meta_boxes( $post_type ) { | |
| 188 | 187 | |
| 189 | 188 | // Don't register the meta box if this Post Type isn't supported. |
| 190 | 189 | $supported_post_types = convertkit_get_supported_post_types(); |
| 191 | 190 | if ( ! in_array( $post_type, $supported_post_types, true ) ) { |
| @@ -191,13 +190,8 @@ | ||
| 191 | 190 | if ( ! in_array( $post_type, $supported_post_types, true ) ) { |
| 192 | 191 | return; |
| 193 | 192 | } |
| 194 | 193 | |
| 195 | - // Don't register the meta box if the block editor is being used, as register_post_meta() handles saving post meta. | |
| 196 | - if ( function_exists( 'use_block_editor_for_post' ) && use_block_editor_for_post( $post ) ) { | |
| 197 | - return; | |
| 198 | - } | |
| 199 | - | |
| 200 | 194 | // Register Meta Box. |
| 201 | 195 | add_meta_box( 'wp-convertkit-meta-box', __( 'Kit', 'convertkit' ), array( $this, 'display_meta_box' ), $post_type, 'normal' ); |
| 202 | 196 | |
| 203 | 197 | // Enqueue JS and CSS. |
| @@ -278,13 +272,8 @@ | ||
| 278 | 272 | } |
| 279 | 273 | |
| 280 | 274 | // Bail if no ConvertKit settings were posted. |
| 281 | 275 | if ( ! isset( $_POST['wp-convertkit'] ) ) { |
| 282 | - return; | |
| 283 | - } | |
| 284 | - | |
| 285 | - // Bail if the current user cannot edit this Post. | |
| 286 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { | |
| 287 | 276 | return; |
| 288 | 277 | } |
| 289 | 278 | |
| 290 | 279 | // Save Post's settings. |