Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get all WordPress.org themes with more than 100.000 active installs
let url = 'https://api.wordpress.org/themes/info/1.2/?action=query_themes&request[search]=%20&request[fields][downloaded]=true&request[fields][active_installs]=true&request[per_page]=-1';
let downloads = 0;
let installs = 0;
let installed = 100000;
let themes_all;
let themes_filtered;
let theme;
fetch( url )
.then( response => {
return response.json()
} )
.then( data => {
themes_all = data['themes'];
themes_filtered = themes_all.filter( a => a.active_installs >= installed );
themes_filtered.sort( ( a, b ) => b.active_installs - a.active_installs );
for ( theme of themes_filtered ) {
downloads += theme['downloaded'];
installs += theme['active_installs'];
console.log( theme['name'] + " had been downloaded " + theme['downloaded'].toLocaleString() + " and installed " + theme['active_installs'].toLocaleString() + " times." );
}
} )
.catch(err => {
console.log( err );
} )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.