Blog

Get active WordPress plugins

WordPress

The code below is an example of a function written in PHP, designed to list all active plugins on a WordPress website. This can be useful for gaining an overview of the plugins being used on a specific website.

function sw_list_active_site_plugins() {
    $plugins = get_option( 'active_plugins' );

    foreach ( $plugins as $key => $value ) {
        $string = explode( '/', $value );
        echo $string[0] . "\n";
    }
}

sw_list_active_site_plugins();