[wp-trac] [WordPress Trac] #40036: Re-save Network Settings ruin starter content

WordPress Trac noreply at wordpress.org
Fri Mar 17 13:02:06 UTC 2017


#40036: Re-save Network Settings ruin starter content
--------------------------------+------------------------
 Reporter:  berfayvel           |       Owner:
     Type:  defect (bug)        |      Status:  new
 Priority:  normal              |   Milestone:  4.7.4
Component:  Networks and Sites  |     Version:  4.7.2
 Severity:  normal              |  Resolution:
 Keywords:  needs-patch         |     Focuses:  multisite
--------------------------------+------------------------

Comment (by shadyvb):

 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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40036#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list