Opened 8 years ago
Closed 8 years ago
#40036 closed defect (bug) (fixed)
Re-save Network Settings ruin starter content
Reported by: | berfayvel | Owned by: | swissspidy |
---|---|---|---|
Milestone: | 4.7.4 | Priority: | normal |
Severity: | normal | Version: | 4.7.2 |
Component: | Networks and Sites | Keywords: | has-patch has-unit-tests |
Focuses: | multisite | Cc: |
Description
On fresh multisite install, I re-save data in wp-admin/network/settings.php. Then I create a sub-site.
When try to edit the sub-site's starter content Sample Page, the content is just blank (no content, only title).
Then I create more sub-sites. But it still same (Sample Page content is blank).
No error generated.
Attachments (3)
Change History (9)
#1
@
8 years ago
- Focuses multisite added
- Keywords needs-patch added
- Milestone changed from Awaiting Review to 4.7.4
#2
@
8 years ago
The reason for this is that only the first_post
value is inserted into the initial DB schema update at https://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes/schema.php#L1009.
Neither first_page
/ first_comment
values are inserted to the database, and once the settings page is saved, the *empty* value is actually saved then.
So, the actual call while setting up new sites in wp_install_defaults
is get_option( 'first_page', $first_page )
, and the way get_option
currently works is that it only returns the passed default value if it *does not exist* in the database, not if it *exists* but empty.
The behaviour is not consistent between the first post and the first page/comment, because wp_install_default
does not do the same with first_post
, instead it will always insert the default content if the saved value is empty https://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes/upgrade.php#L159 ( the post is created anyway, so no use in making it empty ).
Working on patch / tests and will post shortly.
@
8 years ago
Update wp_install_defaults to properly add default content to first page/content if they're saved as empty values
#5
@
8 years ago
40036.diff splits up the previous test into 3 tests to make it easier to work with.
Hi @berfayvel, welcome to WordPress Trac!
Thanks for the report, the First Page content is indeed blank in Network Settings.