activate_plugins() wordpress function and usage

Home / WordPress / WordPress Wiki / activate_plugins() wordpress function and usage

activate_plugins( string|string[] $plugins, string $redirect = '', bool $network_wide = false, bool $silent = false )
This function is used to activate multiple plugins.

Description

When WP_Error is returned, it does not mean that one of the plugins had errors. It means that one or more of the plugin file paths were invalid.

The execution will be halted as soon as one of the plugins has an error.

Parameters

$plugins

(string|string[]) (Required) Single plugin or list of plugins to activate.

$redirect

(string) (Optional) Redirect to page after successful activation.

Default value: ”

$network_wide

(bool) (Optional) Whether to enable the plugin for all sites in the network.

Default value: false

$silent

(bool) (Optional) Prevent calling activation hooks.

Default value: false

Return

(bool|WP_Error) True when finished or WP_Error if there were errors during a plugin activation.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments