Skip to content

Commit 108215a

Browse files
authored
fix(content-gate): create gate layout with 'publish' status (#4483)
* fix(content-gate): create gate layout with 'publish' status * test: assert published status for gate layouts
1 parent e3bb4d7 commit 108215a

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

includes/content-gate/class-content-gate.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,7 @@ public static function create_gate_layout( $title = '', $content = '' ) {
581581
'post_title' => $title,
582582
'post_type' => self::GATE_LAYOUT_CPT,
583583
'post_content' => $content,
584+
'post_status' => 'publish',
584585
],
585586
true // Return WP_Error on failure.
586587
);

tests/unit-tests/content-gate/content-gates.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@ public function test_create_gate_creates_layouts() {
273273
$this->assertNotNull( $custom_access_layout, 'Custom access layout post should exist' );
274274
$this->assertEquals( Content_Gate::GATE_LAYOUT_CPT, $registration_layout->post_type, 'Registration layout should be correct post type' );
275275
$this->assertEquals( Content_Gate::GATE_LAYOUT_CPT, $custom_access_layout->post_type, 'Custom access layout should be correct post type' );
276+
$this->assertEquals( 'publish', $registration_layout->post_status, 'Registration layout should be published' );
277+
$this->assertEquals( 'publish', $custom_access_layout->post_status, 'Custom access layout should be published' );
276278
}
277279

278280
/**

0 commit comments

Comments
 (0)