Skip to content

Instantly share code, notes, and snippets.

@danieliser
Last active April 13, 2023 16:48
Show Gist options
  • Save danieliser/82a27623bc3f707e8d09 to your computer and use it in GitHub Desktop.
Save danieliser/82a27623bc3f707e8d09 to your computer and use it in GitHub Desktop.
Fetch Active Install Count from WordPress Plugins API
<?php
function get_plugin_install_count( $plugin ) {
$api = plugins_api( 'plugin_information', array(
'slug' => 'popup-maker',
'fields' => array( 'active_installs' => true )
) );
if( ! is_wp_error( $api ) ) {
return $api->active_installs;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment