mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 07:40:07 +00:00
REST API: Fix delete widget endpoint
Makes the `DELETE /wp/v2/widgets/:id?force=1` endpoint actually delete the widget from the `"widget-$id_base"` option and not just remove it from `'sidebars_widgets'`. Fixes #53313. Props TimothyBlynJacobs. git-svn-id: https://develop.svn.wordpress.org/trunk@51059 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1304,6 +1304,9 @@ class WP_Test_REST_Widgets_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
|
||||
$response = rest_do_request( '/wp/v2/widgets/text-1' );
|
||||
$this->assertEquals( 404, $response->get_status() );
|
||||
|
||||
$this->assertArrayNotHasKey( 'text-1', get_option( 'sidebars_widgets' )['sidebar-1'] );
|
||||
$this->assertArrayNotHasKey( 1, get_option( 'widget_text' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user