• How do I access a particular WordPress Plugin or Theme stat? Can you share a code or tuts?

    Like this:

    Requires: 3.9 or higher
    Compatible up to: 4.0
    Last Updated: 2014-10-16
    Downloads: 21,084,365

    Ratings

    4.4 out of 5 stars

Viewing 1 replies (of 1 total)
  • Here is rough pass:

    function example_get_downloads() {
    
        if ( ! function_exists( 'plugins_api' ) )
            require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' );
    
        $plugin = array( 'slug' => 'your-plugin-slug' );
        $call_api = plugins_api( 'plugin_information', $plugin );
    
        if ( is_wp_error( $call_api ) ) {
            echo '<pre>' . print_r( $call_api->get_error_message(), true ) . '</pre>';
        } else {
            update_option( 'my_downloads', $call_api->downloaded );
        }
    }
    add_action( 'my_hourly_actions', 'example_get_downloads' );

    This is an example of getting retrieving and saving the downloads counts for a plugin with the slug “your-plugin-slug”. If you var_dump the $call_api you can see how to get all the other data you want. I’ve only done this with plugin data but there is a similar process for theme data and I think you can get there with the info above.

Viewing 1 replies (of 1 total)
  • The topic ‘How do I get WordPress' stats counter?’ is closed to new replies.