# 😎 Edit blocks widget default, widget default (ok)

### Blocks widget default

<figure><img src="https://1113999984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M84NwP_L_qEsBHOa2xo%2Fuploads%2FOFa5FQy1sNAXuAAuwpyn%2Fimage.png?alt=media&#x26;token=f4707564-f1d3-4be2-9f05-7221f3033b9f" alt=""><figcaption></figcaption></figure>

```
// Start modify_block_type_metadata_settings_defaults
function modify_block_type_metadata_settings_defaults($settings, $metadata)
{
  if ($settings['description'] == 'Display a list of your most recent posts.' || $settings['description'] == 'Hiển thị danh sách bài viết mới nhất.') :
    $settings['attributes']['orderBy']['default'] = "rand";
  endif;
  return $settings;
}
add_filter("block_type_metadata_settings", "modify_block_type_metadata_settings_defaults", 10, 2);
// End modify_block_type_metadata_settings_defaults
```

### Widget default

```php
// Start Widget Posts Args
add_filter('widget_posts_args', function ($params) {
	$params['orderby'] = 'rand';
	return $params;
});
// End Widget Posts Args
```
