Skip to content

Commit 95b44c5

Browse files
committed
Test publish to draft.
1 parent 1896812 commit 95b44c5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/class-test-indexnow-pings.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,23 @@ public function test_ping_on_post_trash() {
170170
$this->assertNotPing( home_url( "/?p={$post_id}" ), 'Ping should not include the trashed post URL.' );
171171
}
172172

173+
/**
174+
* Ensure unpublishing a post pings the old URL.
175+
*/
176+
public function test_ping_on_unpublishing() {
177+
$post_id = self::$post_ids['publish'];
178+
179+
wp_update_post(
180+
array(
181+
'ID' => $post_id,
182+
'post_status' => 'draft',
183+
)
184+
);
185+
186+
$this->assertPing( home_url( '/2025/test-post-publish/' ), 'Ping should include the post URL on unpublishing.' );
187+
$this->assertNotPing( home_url( "/?p={$post_id}" ), 'Ping should not include the unpublished post URL.' );
188+
}
189+
173190
/**
174191
* Ensure publishing a draft post pings the URL.
175192
*/

0 commit comments

Comments
 (0)