Skip to content

Commit

Permalink
Merge pull request #1605 from Automattic/add/back-compat-meta-box
Browse files Browse the repository at this point in the history
Prevent a notice from appearing in the Compatibility Tool meta box
  • Loading branch information
westonruter authored Nov 10, 2018
2 parents b7affeb + 51edca0 commit 8dd1b48
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion includes/validation/class-amp-validated-url-post-type.php
Original file line number Diff line number Diff line change
Expand Up @@ -1599,7 +1599,15 @@ public static function add_edit_post_inline_script() {
public static function add_meta_boxes() {
remove_meta_box( 'submitdiv', self::POST_TYPE_SLUG, 'side' );
remove_meta_box( 'slugdiv', self::POST_TYPE_SLUG, 'normal' );
add_meta_box( self::STATUS_META_BOX, __( 'Status', 'amp' ), array( __CLASS__, 'print_status_meta_box' ), self::POST_TYPE_SLUG, 'side' );
add_meta_box(
self::STATUS_META_BOX,
__( 'Status', 'amp' ),
array( __CLASS__, 'print_status_meta_box' ),
self::POST_TYPE_SLUG,
'side',
'default',
array( '__back_compat_meta_box' => true )
);
}

/**
Expand Down
4 changes: 4 additions & 0 deletions tests/validation/test-class-amp-validated-url-post-type.php
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,10 @@ public function test_add_meta_boxes() {
),
$side_meta_box['callback']
);
$this->assertEquals(
array( '__back_compat_meta_box' => true ),
$side_meta_box['args']
);

$contexts = $wp_meta_boxes[ AMP_Validated_URL_Post_Type::POST_TYPE_SLUG ]['side'];
foreach ( $contexts as $context ) {
Expand Down

0 comments on commit 8dd1b48

Please sign in to comment.