WordPress.org

Make WordPress Core

Ticket #16741: 16741.diff

File 16741.diff, 1.0 KB (added by duck_, 7 years ago)
  • wp-includes/plugin.php

     
    667667        // The option should not be autoloaded, because it is not needed in most
    668668        // cases. Emphasis should be put on using the 'uninstall.php' way of
    669669        // uninstalling the plugin.
    670         $uninstallable_plugins = (array) get_option('uninstall_plugins');
    671         $uninstallable_plugins[plugin_basename($file)] = $callback;
    672         update_option('uninstall_plugins', $uninstallable_plugins);
     670        $uninstallable_plugins = get_option('uninstall_plugins');
     671        if ( false === $uninstallable_plugins )
     672                $uninstallable_plugins = array( plugin_basename($file) => $callback );
     673                add_option( 'uninstall_plugins', $uninstallable_plugins, '', 'no' );
     674        } else {
     675                $uninstallable_plugins = (array) $uninstallable_plugins;
     676                $uninstallable_plugins[plugin_basename($file)] = $callback;
     677                update_option( 'uninstall_plugins', $uninstallable_plugins );
     678        }
    673679}
    674680
    675681/**