Plugins API EndpointsLink to this section
URL: https://directory.classicpress.net/wp-json/wp/v2/plugins
You can retrieve a paginated list of all published plugins. The response will hold a JSON object holding the plugin information, as seen below.
URL: https://directory.classicpress.net/wp-json/wp/v2/plugins/?byslug={slug}
The {Slug} represents the plugin name (slug).
You can retrieve information about each published ClassicPress plugin. The response will hold a serialized array of plugin information, as seen in the example below:
[{
"title":{
"rendered":"Switch to ClassicPress"
},
"content":{
"rendered":"Switch your WordPress installation to ClassicPress. Also a tool to try different versions of ClassicPress (also nightly builds or RC).",
"protected":false
},
"excerpt":{
"rendered":"Switch your WordPress installation to ClassicPress. Also a tool to try different versions of ClassicPress (also nightly builds or RC).",
"protected":false
},
"meta":{
"current_version":"1.5.2",
"git_provider":"github",
"requires_cp":"1.7",
"download_link":"https:\/\/github.com\/ClassicPress\/ClassicPress-Migration-Plugin\/releases\/download\/1.5.2\/switch-to-classicpress.zip",
"requires_php":"7.4",
"slug":"switch-to-classicpress",
"developer_name":"ClassicPress",
"category_names":"Tools",
"category_slugs":"tools",
"active_installations":"14",
"published_at":"1738941473",
"item_status":"active",
"premium_uri":"",
"cpcs_status":"passing"
},
"featured_image":"https:\/\/directory.classicpress.net\/wp-content\/uploads\/banner-772x250-1.webp"
}]
The decoded response data object propertiesLink to this section
titleThe name of the plugin.contentThe plugin’s full description. This may contain HTML-markup, such as line breaks.excerptThe plugin’s short description.metaObject describing meta info of the plugin. The object’s properties are:current_versionThe current version (stable) of the plugin.git_providerThe Git provider. Currently only GitHub Supported.requires_cpThe minimally required ClassicPress version.download_linkStable release download link on remote repository.requires_phpThe minimally required PHP version.slugThe slug of the plugin.developer_nameName of the developer.category_namesThe ClassicPress Plugin Directory category or categories.category_slugsThe ClassicPress Plugin Directory category slug(s).active_installationsActive installations of the plugin.published_atWhen the developer published this plugin.item_statusThe plugin status. Values are: active, suspended, closed, ownership (Ownership Changed) or adoption (Plugin is Adoptable).premium_uriRemote repository (Currently only GitHub supported) URL.cpcs_statusWhether the plugin passed the CP Coding Standards or not
featured_imageFull link to the Directory image.
Integration example with ClassicPress/WordPressLink to this section
There are many ways to get a response from an API. If you are using ClassicPress — perhaps you are creating a plugin to display some data about ClassicPress plugins or themes — you can get the response by adopting the following method. We will use a ClassicPress plugin as an example.
Step One: GET a responseLink to this section
Use wp_remote_get to get the API response. Example:
$plugin = 'switch-to-classicpress';$response = wp_remote_get( 'https://directory.classicpress.net/wp-json/wp/v2/plugins/?byslug=' . $plugin );
Step Two: Check for the response Status CodeLink to this section
Check if the response status is 200 OK using wp_remote_retrieve_response_code like so:
if( wp_remote_retrieve_response_code( $response ) === 200 ){// The response status is 200 OK}
Step Three: Retrieve the Response BodyLink to this section
Retrieve the response body using wp_remote_retrieve_body like so:
$response_body = wp_remote_retrieve_body( $response );
Then decode the response using json_decode. Do not forget to stripslashes the response body before decoding it. Example:
$decoded_response = json_decode( stripslashes( $response_body ) );
You now have an object at your disposal that holds the retrieved information about this plugin. Properties of the object are explained in the Plugins API endpoints.
Themes API EndpointsLink to this section
The Themes API works in a similar way. The relevant endpoints are:
https://directory.classicpress.net/wp-json/wp/v2/themes
https://directory.classicpress.net/wp-json/wp/v2/themes/?byslug={slug}