Make WordPress Core


Ignore:
Timestamp:
06/08/2021 01:54:27 AM (5 years ago)
Author:
noisysocks
Message:

Make new WordPress installations use blocks in widget areas instead of widgets

Modifies wp_install_defaults() so that when you install a new WordPress site you
have block in your widget areas, not widgets.

Fixes #53324.
Props isabel_brison, hellofromtonya, andraganescu.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/upgrade.php

    r50981 r51088  
    404404                // Set up default widgets for default theme.
    405405                update_option(
    406                         'widget_search',
     406                        'widget_block',
    407407                        array(
    408                                 2              => array( 'title' => '' ),
    409                                 '_multiwidget' => 1,
    410                         )
    411                 );
    412                 update_option(
    413                         'widget_recent-posts',
    414                         array(
    415                                 2              => array(
    416                                         'title'  => '',
    417                                         'number' => 5,
    418                                 ),
    419                                 '_multiwidget' => 1,
    420                         )
    421                 );
    422                 update_option(
    423                         'widget_recent-comments',
    424                         array(
    425                                 2              => array(
    426                                         'title'  => '',
    427                                         'number' => 5,
    428                                 ),
    429                                 '_multiwidget' => 1,
    430                         )
    431                 );
    432                 update_option(
    433                         'widget_archives',
    434                         array(
    435                                 2              => array(
    436                                         'title'    => '',
    437                                         'count'    => 0,
    438                                         'dropdown' => 0,
    439                                 ),
    440                                 '_multiwidget' => 1,
    441                         )
    442                 );
    443                 update_option(
    444                         'widget_categories',
    445                         array(
    446                                 2              => array(
    447                                         'title'        => '',
    448                                         'count'        => 0,
    449                                         'hierarchical' => 0,
    450                                         'dropdown'     => 0,
    451                                 ),
    452                                 '_multiwidget' => 1,
    453                         )
    454                 );
    455                 update_option(
    456                         'widget_meta',
    457                         array(
    458                                 2              => array( 'title' => '' ),
     408                                2              => array( 'content' => '<!-- wp:search /-->' ),
     409                                3              => array( 'content' => '<!-- wp:group --><div class="wp-block-group"><!-- wp:heading --><h2>' . __( 'Recent Posts' ) . '</h2><!-- /wp:heading --><!-- wp:latest-posts /--></div><!-- /wp:group -->' ),
     410                                4              => array( 'content' => '<!-- wp:group --><div class="wp-block-group"><!-- wp:heading --><h2>' . __( 'Recent Comments' ) . '</h2><!-- /wp:heading --><!-- wp:latest-comments {"displayAvatar":false,"displayDate":false,"displayExcerpt":false} /--></div><!-- /wp:group -->' ),
     411                                5              => array( 'content' => '<!-- wp:group --><div class="wp-block-group"><!-- wp:heading --><h2>' . __( 'Archives' ) . '</h2><!-- /wp:heading --><!-- wp:archives /--></div><!-- /wp:group -->' ),
     412                                6              => array( 'content' => '<!-- wp:group --><div class="wp-block-group"><!-- wp:heading --><h2>' . __( 'Categories' ) . '</h2><!-- /wp:heading --><!-- wp:categories /--></div><!-- /wp:group -->' ),
    459413                                '_multiwidget' => 1,
    460414                        )
     
    465419                                'wp_inactive_widgets' => array(),
    466420                                'sidebar-1'           => array(
    467                                         0 => 'search-2',
    468                                         1 => 'recent-posts-2',
    469                                         2 => 'recent-comments-2',
     421                                        0 => 'block-2',
     422                                        1 => 'block-3',
     423                                        2 => 'block-4',
    470424                                ),
    471425                                'sidebar-2'           => array(
    472                                         0 => 'archives-2',
    473                                         1 => 'categories-2',
    474                                         2 => 'meta-2',
     426                                        0 => 'block-5',
     427                                        1 => 'block-6',
    475428                                ),
    476429                                'array_version'       => 3,
    477430                        )
    478431                );
     432
    479433                if ( ! is_multisite() ) {
    480434                        update_user_meta( $user_id, 'show_welcome_panel', 1 );
Note: See TracChangeset for help on using the changeset viewer.