WordPress and buddypress programming

To Get a List of All Active Plugins Programmatically

Viewing 0 reply threads
  • Author
    Posts
    • #3490
      Michael Mc
      Keymaster
      @mkmcst
      <?php
      /**
       * @package active-plugins
       * @version 1.0
       *
       * Plugin Name: Active Plugins
       * Plugin URI: http://wordpress.org/extend/plugins/#
       * Description: This is a development plugin 
       * Author: Your Name
       * Version: 1.0
       * Author URI: https://example.com/
       */
      
      add_shortcode( 'activeplugins', function(){
      	
      	$active_plugins = get_option( 'active_plugins' );
      	$plugins = "";
      	if( count( $active_plugins ) > 0 ){
      		$plugins = "<ul>";
      		foreach ( $active_plugins as $plugin ) {
      			$plugins .= "<li>" . $plugin . "</li>";
      		}
      		$plugins .= "</ul>";
      	}
      	return $plugins;
      });

      [activeplugins] shortcode. It should now display a list of all active plugins.

Viewing 0 reply threads
  • You must be logged in to reply to this topic.