maybe_disable_automattic_widgets() WordPress Function

The maybe_disable_automattic_widgets() function allows you to disable the default WordPress widgets if your theme does not support them. This is useful for themes that are not designed for use with the default WordPress widgets.

maybe_disable_automattic_widgets() #

Disables the Automattic widgets plugin, which was merged into core.


Source

File: wp-admin/includes/upgrade.php

function maybe_disable_automattic_widgets() {
	$plugins = __get_option( 'active_plugins' );

	foreach ( (array) $plugins as $plugin ) {
		if ( 'widgets.php' === basename( $plugin ) ) {
			array_splice( $plugins, array_search( $plugin, $plugins, true ), 1 );
			update_option( 'active_plugins', $plugins );
			break;
		}
	}
}


Top ↑

Changelog

Changelog
VersionDescription
2.2.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.