enable trash for media wordpress

  1. Go to your WordPress dashboard and click on "Appearance" and then "Editor".
  2. Select the "functions.php" file on the right-hand side.
  3. Add the following code at the end of the file:
add_action('init', 'enable_media_trash');
function enable_media_trash() {
  $wp_customize->get_setting('blogname')
    ->transport = 'postMessage';
  $wp_customize->get_setting('blogdescription')
    ->transport = 'postMessage';
}
  1. Click on the "Update File" button to save the changes.