Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
fc4b196
Block Editor: Register Post Settings Panel
n7studios Feb 24, 2026
9658be1
Don’t register meta box if using the block editor
n7studios Feb 24, 2026
ecee309
Build Plugin Sidebar registration system
n7studios Feb 24, 2026
c88f047
Separate out meta_key property
n7studios Feb 24, 2026
551dfba
Coding Standards
n7studios Feb 24, 2026
c4a7710
Merge branch 'main' into register-block-editor-post-settings
n7studios Feb 26, 2026
73ea33f
Tests: Pre-publish actions: Support 7.0 ID selectors
n7studios Feb 26, 2026
3016bab
Tests: Update db_version
n7studios Feb 26, 2026
89cfc47
Revert DB version change
n7studios Mar 5, 2026
40f6020
Tests: Revert named selector on pre-publish actions
n7studios Mar 5, 2026
9717801
Merge branch 'main' into register-block-editor-post-settings
n7studios Mar 9, 2026
51edf92
Coding standards
n7studios Mar 10, 2026
3bfc54e
Tests: Block Editor: Register Post Settings
n7studios Mar 11, 2026
ccf4d3e
Tests: Page Form
n7studios Mar 11, 2026
04ccb62
Create new cest for block editor pages
n7studios Mar 11, 2026
060e577
Revert PageFormCest to original
n7studios Mar 11, 2026
d1ad7f9
Page Form Tests
n7studios Mar 11, 2026
310ce06
Merge remote-tracking branch 'origin/tests-move-bulk-quick-edit-form'…
n7studios Mar 11, 2026
08a3c44
Merge branch 'register-block-editor-post-settings' into register-bloc…
n7studios Mar 11, 2026
13909f2
Remove configurePluginSidebarSettings = default
n7studios Mar 11, 2026
54f19f1
Page Form Tests: Use Classic Editor
n7studios Mar 11, 2026
b6ed48d
Use Kit Logo for Sidebar Icon
n7studios Mar 12, 2026
bf52519
Merge branch 'register-block-editor-post-settings' into register-bloc…
n7studios Mar 12, 2026
63ed48e
Added `addClassicEditorParagraph` helper
n7studios Mar 12, 2026
f3be0fd
Added editor switching test
n7studios Mar 12, 2026
f5e4c7a
Tests: Add FormBlockEditorCest
n7studios Mar 12, 2026
0ff7a4a
Revert PageFormCest
n7studios Mar 12, 2026
09328ed
Added FormClassicEditorCest
n7studios Mar 12, 2026
8cc994f
Replace configureMetaboxSettings with configurePluginSidebarSettings
n7studios Mar 12, 2026
7721d25
Coding standards
n7studios Mar 12, 2026
d3b2327
Revert forms/post-types tests
n7studios Mar 12, 2026
dee076c
Updates tests to use configurePluginSidebarSettings; add `testFormSet…
n7studios Mar 12, 2026
671b50a
Use window.wp.editPost for < WordPress 6.6 compat
n7studios Mar 12, 2026
1957b11
Merge branch 'register-block-editor-post-settings' into register-bloc…
n7studios Mar 12, 2026
8786c9c
Fix tests
n7studios Mar 12, 2026
7b4d9b8
Fix tests
n7studios Mar 12, 2026
54837d8
Merge branch 'main' into register-block-editor-post-settings
n7studios Mar 20, 2026
a40a0e3
Merge branch 'register-block-editor-post-settings' into register-bloc…
n7studios Mar 20, 2026
73d15ad
Merge branch 'main' into register-block-editor-post-settings
n7studios Mar 24, 2026
9de5a74
Merge branch 'register-block-editor-post-settings' into register-bloc…
n7studios Mar 24, 2026
07605f9
Tests: Classic Editor: Metabox: Form
n7studios Mar 25, 2026
226629a
Request Review when Post Meta saved with a Form or Landing Page
n7studios Mar 25, 2026
1938a52
Plugin Sidebar: Register minimal version for register_post_meta()
n7studios Mar 25, 2026
cc2ba49
Limit tests to 8.1
n7studios Mar 25, 2026
c4d818d
Merge branch 'register-block-editor-post-settings' into register-bloc…
n7studios Mar 25, 2026
0ca2933
Tests: CPT: Add support for Custom Fields
n7studios Mar 25, 2026
ec73afa
Merge remote-tracking branch 'origin/tests-read-landing-page-id-env-v…
n7studios Mar 25, 2026
7583351
Merge branch 'register-block-editor-post-settings' into register-bloc…
n7studios Mar 25, 2026
e5c8606
Fix tests
n7studios Mar 26, 2026
af36339
save_post_meta: Remove block editor check, otherwise Quick Edit savin…
n7studios Mar 26, 2026
af888cd
Merge branch 'register-block-editor-post-settings' into register-bloc…
n7studios Mar 26, 2026
82fecf5
Tests: Support WordPress 6.2.8 Plugin Sidebar
n7studios Mar 26, 2026
b91efe1
Tests: Fix missing actor in configurePluginSidebarSettings call
n7studios Mar 26, 2026
99eaf4a
Run Tests against all PHP versions
n7studios Mar 26, 2026
9dd6e1f
Merge branch 'register-block-editor-post-settings-tests' into tests-c…
n7studios Mar 26, 2026
46c599e
Rename test
n7studios Mar 26, 2026
0bd621e
Tests: Block Editor: Form Setting: Refactor Tests
n7studios Mar 26, 2026
f687ae3
Run tests against Post Types
n7studios Mar 26, 2026
ae403de
Remove `checkSelectFormOptionOrder`, as SelectOptionOrderCest covers …
n7studios Mar 26, 2026
954de3b
Merge branch 'tests-classic-editor-metabox-form' into tests-forms-ref…
n7studios Mar 26, 2026
3ae2ea2
Tests: Forms: Bulk & Quick Edit: Refactor Tests
n7studios Mar 26, 2026
a6e1c03
Tests: Settings: Define default Form for Articles CPT
n7studios Mar 26, 2026
f2f24bb
Rename tests, docblocks and comments to reflect test functionality
n7studios Mar 26, 2026
703bbed
Tests: Add `addClassicEditorPageToDatabase` helper
n7studios Mar 26, 2026
c4a8747
Tests: Accessibility: Check all Post Types
n7studios Mar 26, 2026
9263fc1
Tests: Try using waitForElementClickable
n7studios Mar 26, 2026
0a41b82
Run failing test in isolation
n7studios Mar 26, 2026
54d66de
Click body to fix focus issue with publish button not clicking
n7studios Mar 26, 2026
e5ef451
Reinstate all tests
n7studios Mar 26, 2026
746b988
Run failing tests in isolation
n7studios Mar 26, 2026
bbecd44
Reinstate all tests
n7studios Mar 26, 2026
247f6b2
Merge branch 'tests-classic-editor-metabox-form' into tests-forms-ref…
n7studios Mar 26, 2026
4269786
Merge branch 'tests-forms-refactor-block-editor-tests' into tests-for…
n7studios Mar 26, 2026
cb94775
Use retryClick
n7studios Mar 26, 2026
a44b50d
Merge branch 'main' into register-block-editor-post-settings
n7studios Mar 27, 2026
d5f2c00
Merge branch 'register-block-editor-post-settings' into register-bloc…
n7studios Mar 27, 2026
e171fca
Merge branch 'register-block-editor-post-settings-tests' into tests-c…
n7studios Mar 27, 2026
6208077
Merge branch 'tests-classic-editor-metabox-form' into tests-forms-ref…
n7studios Mar 27, 2026
90da0fa
Merge branch 'tests-forms-refactor-block-editor-tests' into tests-for…
n7studios Mar 27, 2026
ba041d2
Configure retryClick
n7studios Mar 27, 2026
edf7bd2
Run failing tests in isolation
n7studios Mar 27, 2026
9bf9adc
Use JS for publish button click
n7studios Mar 27, 2026
f3f3cee
Reinstate all tests
n7studios Mar 27, 2026
20d607e
Tests: Perfmatters: Disable load_textdomain ‘doing it wrong’ message
n7studios Mar 27, 2026
77a90c8
Remove focus from Select2 after filling field
n7studios Mar 27, 2026
cdfef8d
Isolate tests, don’t run on CPT
n7studios Mar 27, 2026
17bc2af
Reduce test to a single post type
n7studios Mar 27, 2026
9265011
Reinstate all post types; add a wait() for publishing
n7studios Mar 27, 2026
34fb032
Reinstate all tests
n7studios Mar 27, 2026
6168e3d
Merge remote-tracking branch 'origin/tests-fix-publish-classic-editor…
n7studios Mar 27, 2026
585e0c1
Merge branch 'register-block-editor-post-settings' into register-bloc…
n7studios Mar 27, 2026
f28ea0e
Merge branch 'register-block-editor-post-settings-tests' into tests-c…
n7studios Mar 27, 2026
687d6d4
Merge branch 'tests-classic-editor-metabox-form' into tests-forms-ref…
n7studios Mar 27, 2026
25c53a1
Merge branch 'tests-forms-refactor-block-editor-tests' into tests-for…
n7studios Mar 27, 2026
2a5cacd
Tests: Classic Editor: No Forms: Refactor
n7studios Mar 27, 2026
83e61c8
Fix tests
n7studios Mar 27, 2026
47490eb
Coding Standards
n7studios Mar 27, 2026
a00bcf3
Merge branch 'tests-forms-refactor-block-editor-tests' into tests-for…
n7studios Mar 27, 2026
cc05ed6
Fix tests
n7studios Mar 27, 2026
58a1d83
Merge branch 'tests-forms-bulk-quick-edit-refactor' into tests-no-for…
n7studios Mar 27, 2026
d96f589
Merge pull request #1053 from Kit/tests-classic-editor-metabox-form
n7studios Mar 30, 2026
0360a02
Merge pull request #1041 from Kit/register-block-editor-post-settings…
n7studios Mar 30, 2026
f2a53bd
Merge branch 'main' into register-block-editor-post-settings
n7studios Mar 30, 2026
281a8dd
Merge branch 'register-block-editor-post-settings' of github.com:Conv…
n7studios Mar 30, 2026
c8951cf
Merge branch 'main' into register-block-editor-post-settings
n7studios Mar 30, 2026
5d88d62
Merge branch 'move-performance-plugin-tests' into register-block-edit…
n7studios Mar 30, 2026
5258230
Merge branch 'register-block-editor-post-settings' into tests-forms-r…
n7studios Mar 30, 2026
9bc9911
Merge branch 'tests-forms-refactor-block-editor-tests' into tests-for…
n7studios Mar 30, 2026
a4922d4
Merge branch 'tests-forms-bulk-quick-edit-refactor' into tests-no-for…
n7studios Mar 30, 2026
5372d6c
Fix tests
n7studios Mar 30, 2026
ac0306c
Merge branch 'tests-forms-refactor-block-editor-tests' into tests-for…
n7studios Mar 30, 2026
cac6954
Merge branch 'tests-forms-bulk-quick-edit-refactor' into tests-no-for…
n7studios Mar 30, 2026
6aff81d
Merge pull request #1058 from Kit/tests-no-forms-refactor
n7studios Mar 31, 2026
453386e
Merge pull request #1055 from Kit/tests-forms-bulk-quick-edit-refactor
n7studios Mar 31, 2026
660f30e
Merge pull request #1054 from Kit/tests-forms-refactor-block-editor-t…
n7studios Mar 31, 2026
44ee6a7
Merge branch 'main' into register-block-editor-post-settings
n7studios Mar 31, 2026
c552308
Merge branch 'register-block-editor-post-settings' of github.com:Conv…
n7studios Mar 31, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions admin/class-convertkit-admin-post.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

/**
* Registers a metabox on Posts, Pages and public facing Custom Post Types
* and saves its settings when the Post is saved in the WordPress Administration
* interface.
* that do not use the block editor, saving settings when the Post is saved
* in the WordPress Administration interface.
*
* @package ConvertKit
* @author ConvertKit
Expand All @@ -27,7 +27,7 @@ public function __construct() {
add_filter( 'views_edit-page', array( $this, 'output_wp_list_table_buttons' ) );

add_action( 'post_submitbox_misc_actions', array( $this, 'output_pre_publish_actions' ) );
add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 10, 2 );
add_action( 'save_post', array( $this, 'save_post_meta' ) );

}
Expand Down Expand Up @@ -181,16 +181,22 @@ public function output_pre_publish_actions( $post ) {
*
* @since 1.9.6
*
* @param string $post_type Post Type.
* @param string $post_type Post Type.
* @param WP_Post $post Post.
*/
public function add_meta_boxes( $post_type ) {
public function add_meta_boxes( $post_type, $post ) {

// Don't register the meta box if this Post Type isn't supported.
$supported_post_types = convertkit_get_supported_post_types();
if ( ! in_array( $post_type, $supported_post_types, true ) ) {
return;
}

// Don't register the meta box if the block editor is being used, as register_post_meta() handles saving post meta.
if ( function_exists( 'use_block_editor_for_post' ) && use_block_editor_for_post( $post ) ) {
return;
}

// Register Meta Box.
add_meta_box( 'wp-convertkit-meta-box', __( 'Kit', 'convertkit' ), array( $this, 'display_meta_box' ), $post_type, 'normal' );

Expand Down
79 changes: 79 additions & 0 deletions includes/class-convertkit-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public function __construct() {
// Register Gutenberg Blocks.
add_action( 'init', array( $this, 'add_blocks' ) );

// Register Gutenberg Plugin Sidebars.
add_action( 'init', array( $this, 'add_plugin_sidebars' ) );

// Register REST API routes.
add_action( 'rest_api_init', array( $this, 'register_routes' ) );

Expand Down Expand Up @@ -187,6 +190,71 @@ public function add_blocks() {

}

/**
* Registers post meta for any registered plugin sidebars using register_post_meta(),
* so data is saved when using the Gutenberg editor.
*
* @since 3.3.0
*/
public function add_plugin_sidebars() {

// Get plugin sidebars.
$plugin_sidebars = convertkit_get_plugin_sidebars();

// Bail if no plugin sidebars are available.
if ( ! count( $plugin_sidebars ) ) {
return;
}

foreach ( $plugin_sidebars as $plugin_sidebar ) {
register_post_meta(
'',
$plugin_sidebar['meta_key'],
array(
'show_in_rest' => array(
'schema' => array(
'type' => 'object',
'properties' => $plugin_sidebar['attributes'],
),
),
'single' => true,
'type' => 'object',
'default' => $plugin_sidebar['default_values'],
'sanitize_callback' => function ( $meta ) use ( $plugin_sidebar ) {

// If the value is not an array, return the default values.
if ( ! is_array( $meta ) ) {
return $plugin_sidebar['default_values'];
}

// Iterate through the attributes and sanitize the meta.
foreach ( $plugin_sidebar['attributes'] as $key => $attribute ) {
$meta[ $key ] = sanitize_text_field( $meta[ $key ] ?? $attribute['default'] );
}

// If a Form or Landing Page was specified, request a review.
// This can safely be called multiple times, as the review request
// class will ensure once a review request is dismissed by the user,
// it is never displayed again.
if ( $meta['form'] || $meta['landing_page'] ) {
WP_ConvertKit()->get_class( 'review_request' )->request_review();
}

// Return the sanitized meta.
return $meta;

},
'auth_callback' => function () use ( $plugin_sidebar ) {

return current_user_can( $plugin_sidebar['minimum_capability'] );

},
)
);
}

}

/**
* Determines the block API version to use for registering blocks.
*
Expand Down Expand Up @@ -214,6 +282,7 @@ public function get_block_api_version() {
return absint( $block_api_version );

}

/**
* Enqueues scripts for Gutenberg blocks in the editor view.
*
Expand All @@ -233,13 +302,23 @@ public function enqueue_scripts() {
$blocks = convertkit_get_blocks();
$block_formatters = convertkit_get_block_formatters();
$pre_publish_actions = convertkit_get_pre_publish_actions();
$plugin_sidebars = convertkit_get_plugin_sidebars();

// Enqueue Gutenberg Javascript, and set the blocks data.
wp_enqueue_script( 'convertkit-gutenberg', CONVERTKIT_PLUGIN_URL . 'resources/backend/js/gutenberg.js', array( 'jquery' ), CONVERTKIT_PLUGIN_VERSION, true );
wp_localize_script( 'convertkit-gutenberg', 'convertkit_blocks', $blocks );

// If pre-publish actions are available, set the data.
if ( count( $pre_publish_actions ) ) {
wp_localize_script( 'convertkit-gutenberg', 'convertkit_pre_publish_actions', $pre_publish_actions );
}

// If plugin sidebars are available, set the data.
if ( count( $plugin_sidebars ) ) {
wp_localize_script( 'convertkit-gutenberg', 'convertkit_plugin_sidebars', $plugin_sidebars );
}

// Set the Gutenberg data.
wp_localize_script(
'convertkit-gutenberg',
'convertkit_gutenberg',
Expand Down
1 change: 1 addition & 0 deletions includes/class-wp-convertkit.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ private function initialize_global() {
$this->classes['block_formatter_form_link'] = new ConvertKit_Block_Formatter_Form_Link();
$this->classes['block_formatter_product_link'] = new ConvertKit_Block_Formatter_Product_Link();
$this->classes['pre_publish_action_broadcast_export'] = new ConvertKit_Pre_Publish_Action_Broadcast_Export();
$this->classes['plugin_sidebar_post_settings'] = new ConvertKit_Plugin_Sidebar_Post_Settings();
$this->classes['broadcasts_exporter'] = new ConvertKit_Broadcasts_Exporter();
$this->classes['broadcasts_importer'] = new ConvertKit_Broadcasts_Importer();
$this->classes['elementor'] = new ConvertKit_Elementor();
Expand Down
24 changes: 24 additions & 0 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,30 @@ function convertkit_get_block_formatters() {

}

/**
* Helper method to get registered plugin sidebars.
*
* @since 3.3.0
*
* @return array Plugin sidebars
*/
function convertkit_get_plugin_sidebars() {

$plugin_sidebars = array();

/**
* Registers plugin sidebars for the WordPress block editor.
*
* @since 3.3.0
*
* @param array $plugin_sidebars Plugin sidebars.
*/
$plugin_sidebars = apply_filters( 'convertkit_plugin_sidebars', $plugin_sidebars );

return $plugin_sidebars;

}

/**
* Helper method to get registered pre-publish actions.
*
Expand Down
Loading
Loading