Updated 02 – 05 – 18: plugins object is now returned as an array.
On a whim this May bank holiday, tucked up on the sofa watching movies, I decided to create a plugin to display my favourited plugins on WordPress.org.
After a bit of digging I found you can use the plugins_api() function and pass it a username, e.g.:
plugins_api( 'query_plugins', array( 'user' => emirpprime, 'per_page' => '-1' ) );
This returns an object with some information about the results, then an array of plugins. A stripped down example of the structure is below:
stdClass Object
(
[info] => Array
(
[page] => 1
[pages] => 0
[results] => 57
)
[plugins] => Array
(
[0] => Array
(
[name] => Autoptimize
[slug] => autoptimize
[version] => 2.1.0
[author] => <a href="http://blog.futtta.be/">Frank Goossens (futtta)</a>
[author_profile] => https://profiles.wordpress.org/optimizingmatters
[requires] => 4.0
[tested] => 4.7.5
[compatibility] => Array
(
)
[rating] => 94
[ratings] => Array
(
[5] => 419
[4] => 23
[3] => 12
[2] => 8
[1] => 22
)
[num_ratings] => 484
[support_threads] => 121
[support_threads_resolved] => 81
[downloaded] => 1349088
[last_updated] => 2016-12-14 5:45am GMT
[added] => 2009-07-09
[homepage] => http://blog.futtta.be/autoptimize
[sections] => Array
(
[description] => Autoptimize makes ...
[installation] => Just install from your WordPress...
[faq] => Installation Instructions...
[short_description] => Autoptimize speeds up your website and helps you save bandwidth by aggregating and minimizing JS, CSS and HTML.
[download_link] => https://downloads.wordpress.org/plugin/autoptimize.2.1.0.zip
[screenshots] => Array
(
)
[tags] => Array
(
[css] => css
[html] => html
[javascript] => javascript
[js] => JS
[minify] => minify
)
[versions] => Array
(
[0.1] => https://downloads.wordpress.org/plugin/autoptimize.0.1.zip
...
[trunk] => https://downloads.wordpress.org/plugin/autoptimize.zip
)
[donate_link] => http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
[contributors] => Array
(
)
)
)
)
)
A simple loop over the plugins
array will get all the details about a plugin you could want.
A short while later, and a rough and ready version is complete – a basic plugin that registers a shortcode and returns a list of a user’s plugins.
What does the plugin output?
Here are my favourites as an example – the markup is basic but easy to style, with a couple of classes for targetting. I’ve kept it simpler than the layout in wp-admin or the plugin repository, but hopefully with enough info to be useful:
Found: 61
Automatically all of a nav menu item's descendants as submenu items. Designed for pages but will work with any hierarchical post type or taxonomy …
Autoptimize speeds up your website by optimizing JS, CSS, images (incl. lazy-load), HTML and Google Fonts, asyncing JS, removing emoji cruft and more.
Automatic updating of the comment block list in WordPress with antispam keys from GitHub.
Check posts, pages, and all content for broken links to improve SEO. Get notified when bad links are found.
A lightweight plugin to add thousands of taxonomy terms in one go.
Enables the previous "classic" editor and the old-style Edit Post screen with TinyMCE, Meta Boxes, etc. Supports all plugins that extend this screen.
The "Classic Editor +" plugin disables the block editor, removes enqueued scripts/styles and brings back classic Widgets.
Simple, option-less, plugin to make TinyMCE – the WordPress Visual Editor – easier for clients and n00bs.
All of Cloudflare’s performance and security benefits in a simple one-click install.
An easy, clean and simple way to enhance your site with code snippets.
Take control and protect your site today! Censor all content containing profanity, swearing, offensive, and abusive comments. Flexible Plugin options.
Admin UI for creating custom content types like post types and taxonomies
Debugging tool for theme authors and reviewers.
A plugin, which helps WordPress developers develop.
Allows administrators to globally disable comments on their site. Comments can be disabled according to post type. Multisite friendly.
Disable the use of the REST API on your website to site users. Now with User Role support!
Disables the WP REST API for visitors not logged into WordPress.
The best WordPress backup and migration plugin. Quickly and easily backup ,migrate, copy, move, or clone your site from one location to another.
A lightweight plugin that protects email addresses from email-harvesting robots, by encoding them into decimal and hexadecimal entities.
Easily replace any attached image/file by simply uploading a new file in the Media Library edit view – a real time saver!
What do you think? Is there any other info you think would be useful to include? Let me know in the comments.
Leave a Reply