There have been some recent additions to the WordPress.org plugin repository. Most notably the changes to the plugin page and the author profile page which now shows an authors favorite plugins.

I want to create a sidebar widget plugin that shows a plugin authors favorites. I know how to use the API to get plugin stats and have also read DD32's API Docs but I don't believe docs exist on profiles or if a profile API even exists.

I attempted to use wp_remote_get and I am able to get the body html from the profile page but haven't attempted to try and parse it yet as it seems a way to messy way of going about it. It would be great if I could get the profile in XML or json.

Are there any methods that I'm missing or does a profile API exist?


Ok I have a beta version up on github using the SimpleHTML Dom parser. I don't think I will be able to get the star ratings but I'm pretty happy with the results as a first go without an API.

WordPress.org does not allow content scraping and will ban you (via @otto). So this is a no go until a public API is released.

  • 1
    As a temporary solution until Otto implements the profile API - use SimpleHTMLDom Parser to scrape the content you need. If you can get the author profile URL programatically then you're good to go. Swap out with official API calls when ready. simplehtmldom.sourceforge.net & simplehtmldom.sourceforge.net/manual.htm
    – Adam
    May 17, 2012 at 22:20
  • Excellent idea. I can already form the urls and get the html output from the page.
    – Chris_O
    May 17, 2012 at 22:28
  • You can get the star rating by copying the CSS properties for div.star-holder .star-rating selectors and serving those from the plugin style sheet. Make sure you copy the star rating background image over too. Then, when you scrape the <div class="star-rating" style="width:??px"></div> element, your css property will output the display of stars (whatever their rating) since it's controlled by the width of the div. Easy peasy.
    – Adam
    May 18, 2012 at 14:49
  • Further more, to differentiate the stars, just change their color in Photoshop so its not a direct rip of the WordPress blue or alternatively if you want to be clever about it, create a series of color variations that your users can choose from to suit the aesthetics of their site. I use SimpleHTMLDom Parser a lot, in cases where no API exists, nor lets say an RSS feed (if that's my goal). Its as effective as the real thing, granted that if anything changes you will need to update your code to reflect that. But in the absence of real access to an API it can provide you with access to content.
    – Adam
    May 18, 2012 at 14:52

2 Answers 2


Not yet.

Otto said 'soon' on Wednesday. But he went to a BBQ this weekend, so 'soon' is probably 'This month.' ;)


Otto42: @Ipstenu @EricMann I have code to do that, but not deployed yet. Some debate over the best way. It will be there eventually.

  • 2
    Understood... BBQ always trumps WordPress.
    – Chris_O
    May 17, 2012 at 20:52

The favorited plugins has been added to the WordPress.org API. There is a new feature in 3.5 that allows you to access your favorites from the plugin installer.

See http://core.trac.wordpress.org/ticket/22002 for info on how it is being used in core.

The API allows you to retrieve an object that contains contains each plugins

  • name
  • description
  • author
  • rating
  • last updated date
  • change log
  • stable version
  • works with wp version

To retrieve the object

Make a call to http://api.wordpress.org/plugins/info/1.0/ using wp_remote_post passing an array of arguments including the action which would be 'query_plugins' and the wp dot org username to retrieve the favorites from.

$request = wp_remote_post('http://api.wordpress.org/plugins/info/1.0/', array( 'timeout' => 15, 'body' => array('action' => $action, 'request' => serialize($args))) );

Before you have a nice clean object you need to do some error handling and other parsing. Here is an example function that will return a nice clean object holding all the plugin details.

function api( $action, $args ) {
        if ( is_array( $args ) )
            $args = (object) $args;

        $request = wp_remote_post('http://api.wordpress.org/plugins/info/1.0/', array( 'timeout' => 15, 'body' => array('action' => $action, 'request' => serialize($args))) );
        if ( is_wp_error($request) ) {
            $res = new WP_Error('plugins_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.' ), $request->get_error_message() );
        } else {
            $res = maybe_unserialize( wp_remote_retrieve_body( $request ) );
            if ( ! is_object( $res ) && ! is_array( $res ) )
                $res = new WP_Error('plugins_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.' ), wp_remote_retrieve_body( $request ) );

        return apply_filters( 'c3m_favorite_results', $res, $action, $args );


This example usage will give you an unordered list of favorite plugins along with a link to the plugin on dot org, a link to the author uri and the star rating.

$api_data = api( 'query_plugins', array( 'user' => 'my_dot_org_username' ) );
$api_plugins = $api_data->plugins;

echo '<ul class="c3m-favorites">';
        foreach( $api_plugins as $plugin ) {

            $name = $plugin->name; ?>
            <li><strong><a target="_blank" href="http://wordpress.org/extend/plugins/<?php echo $plugin->slug ?>/"><?php echo esc_html( $name ); ?></a></strong><br>

                <div class="star-holder" title="<?php printf( _n( '(based on %s rating)', '(based on %s ratings)', $plugin->num_ratings ), number_format_i18n( $plugin->num_ratings ) ); ?>">
                <div class="star star-rating" style="width: <?php echo esc_attr( str_replace( ',', '.', $plugin->rating ) ); ?>px"></div></div>

                <em><?php _e('By: ') ?></em> <?php echo links_add_target( $plugin->author, '_blank' ). '<br>'; ?>
        echo '</ul>';


enter image description here

Widget screenshot from my Favorite Plugins Widget plugin: http://wordpress.org/extend/plugins/favorite-plugins-widget/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.