Skip to content

Commit 21c56a7

Browse files
authored
Merge pull request #290 from wp-cli/update/site-empty
2 parents d32e1f5 + 3d82810 commit 21c56a7

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

features/site-empty.feature

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ Feature: Empty a WordPress site of its data
5959
{PAGE_ID}
6060
"""
6161

62+
When I run `wp post create --post_title='Sticky Post' --post_content='This is just a sticky post' --porcelain`
63+
Then save STDOUT as {STICKY_POST_ID}
64+
65+
When I run `wp option set sticky_posts '[{STICKY_POST_ID}]' --format=json`
66+
Then STDOUT should be:
67+
"""
68+
Success: Updated 'sticky_posts' option.
69+
"""
70+
6271
When I run `wp site empty --yes`
6372
Then STDOUT should be:
6473
"""
@@ -78,6 +87,12 @@ Feature: Empty a WordPress site of its data
7887
0
7988
"""
8089

90+
When I run `wp option get sticky_posts --format=json`
91+
Then STDOUT should be:
92+
"""
93+
[]
94+
"""
95+
8196
When I run `wp db query "SELECT COUNT(link_id) FROM wp_links;"`
8297
Then STDOUT should be:
8398
"""

src/Site_Command.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ private function insert_default_terms() {
204204
private function reset_options() {
205205
// Reset Privacy Policy value to prevent error.
206206
update_option( 'wp_page_for_privacy_policy', 0 );
207+
208+
// Reset sticky posts option.
209+
update_option( 'sticky_posts', [] );
207210
}
208211

209212
/**

0 commit comments

Comments
 (0)