WordPress.org API « WordPress Codex (original) (raw)
WordPress.org API's is a set of API's on WordPress.org web site.
Contents
- 1 Secret Key
- 2 Stats
- 3 Version Check
- 4 Version Stability
- 5 Credits
- 6 Translations
- 7 Themes
- 8 Plugins
- 9 Block Patterns
- 10 Popular Import Plugin
- 11 Checksum
- 12 Editor
- 13 Events
- 14 Browse Happy
- 15 Serve Happy
Secret Key
Secret key generator for wp-config.php.
- https://api.wordpress.org/secret-key/1.0/
- https://api.wordpress.org/secret-key/1.1/
- https://api.wordpress.org/secret-key/1.1/salt/
Stats
Stats about the systems websites are running WordPress on.
- https://api.wordpress.org/stats/wordpress/1.0/
- https://api.wordpress.org/stats/php/1.0/
- https://api.wordpress.org/stats/mysql/1.0/
- https://api.wordpress.org/stats/locale/1.0/
- https://api.wordpress.org/stats/plugin/1.0/{slug}
- https://api.wordpress.org/stats/plugin/1.0/downloads.php?slug={slug}&limit={days}&callback={jsFunction}
Version Check
WordPress Version Checker.
- https://api.wordpress.org/core/version-check/1.6/ (PHP serialized)
- https://api.wordpress.org/core/version-check/1.7/ (python)
Version Stability
Check if a version of WordPress is latest, outdated, or insecure.
Credits
Details about the various individuals who contribute to the WordPress code base. Used in Credits Screen. Available since WordPress 3.2, Locale may optionally be specified.
- https://api.wordpress.org/core/credits/1.0/
- https://api.wordpress.org/core/credits/1.1/?version={wp-version}&locale={wp-locale}
Translations
Available translations.
- https://api.wordpress.org/translations/core/1.0/?version={wp-version} (where the version number starts from 4.0)
- https://api.wordpress.org/translations/plugins/1.0/?slug={slug}&version={plugin-version}
- https://api.wordpress.org/translations/themes/1.0/?slug={slug}&version={theme-version}
Fallbacks are also supported, for example:
- https://api.wordpress.org/translations/plugins/1.0/?slug=bbpress&version=2.5.1 for example falls back to the 2.5 translations
- https://api.wordpress.org/translations/plugins/1.0/?slug=bbpress&version=2.5.100 falls back to the 2.5.11 translations (the latest available)
Themes
v1.0 will return its content in PHP serialized form, v1.1 and v.1.2 as JSON objects.
- https://api.wordpress.org/themes/info/1.0/
- https://api.wordpress.org/themes/info/1.1/
- https://api.wordpress.org/themes/info/1.2/
The major changes between 1.1 and 1.2 are:
- Only accepts GET requests
- The `request` keys can passed as parent keys
- Greater number of fields are included by default (See source-code below)
Note: You can find information about arguments and examples in the following blog articles:
- v1.2: https://wplake.org/blog/wordpress-org-api/
- v1.0: http://wp.tutsplus.com/tutorials/plugins/communicating-with-the-wordpress-org-plugin-api/
The source-code behind this API is available here:https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-themes-api.php
Parameter:
$action
(string) (required) Possible actions are:
- query_themes - A a list of themes.
- theme_information - Information about a specific theme.
- hot_tags - List of the most popular theme tags.
- feature_list - List of valid theme tags.
Default: None
$request
(array) (optional) Arguments to alter the output of this endpoint.
Default: empty
The arguments outlined for each endpoint should be passed in the $request parameter.
List of Themes
Returns a list of themes with their associated information, as well as meta information about the request. It provides multiple filters to search: text string, feature tags, author, and provides some capability for sorting (popular, featured, updated, new).
$action
(string) (required) query_themes
Default: None
Example query: api.wordpress.org/themes/info/1.1/?action=query_themes&request[tag]=sticky-post&request[tag]=two-columns&request[search]=food&request[page]=2
Arguments:
search
(string) (optional) Textual search, using a free-form string.
Default: null
tag
(string) (optional) Filter to return themes with a specified tag or set of tags (pass an array of string).
Default: null
theme
(string) (optional) Slug of a specific theme to return.
Default: null
author
(string) (optional) WordPress.org username of the author. Filter to return only themes authored by them.
Default: null
page
(int) (optional) The page currently returned.
Default: 1
per_page
(int) (optional) Amount of themes returned per page.
Default: null (24)
browse
(string) (optional) Predefined query ordering. Possible values are:
- (no value) - Query all themes by default order.
- popular - Themes ordered by popularity.
- featured - Set of featured themes.
- updated - Recently updated themes.
- new - Latest themes.
Default: null
fields
(array) (optional) Theme information to return. Associative array with field names as keys and a boolean whether to include that field or not, as value.
Default:
- description - false
- sections - false
- rating - true
- ratings - false
- downloaded - true
- download_link - true
- last_updated - true
- homepage - true
- tags - true
- template - true
- parent - false
- versions - false
- screenshot_url - true
- active_installs - false
Theme Information
Returns information about a specific theme.
$action
(string) (required) theme_information
Default: None
Arguments:
slug
(string) (null) Slug of a specific theme to return.
Default: None
fields
(array) (optional) Theme information to return. Associative array with field names as keys and a boolean whether to include that field or not, as value.
Default:
- description - false
- sections - false
- rating - true
- ratings - false
- downloaded - true
- download_link - true
- last_updated - true
- homepage - true
- tags - true
- template - true
- parent - false
- versions - false
- screenshot_url - true
- active_installs - false
Popular theme tags
Returns a list of the most popular theme tags.
$action
(string) (required) hot_tags
Default: None
Arguments:
number
(int) (optional) The amount of tags to return.
Default: -1 (all tags)
Feature list
Returns a list of valid theme tags.
$action
(string) (required) feature_list
Default: None
Update Check
- https://api.wordpress.org/themes/update-check/1.0/
- https://api.wordpress.org/themes/update-check/1.1/
Plugins
- https://api.wordpress.org/plugins/info/1.0/{slug}
- https://api.wordpress.org/plugins/info/1.0/{slug}.json
- https://api.wordpress.org/plugins/update-check/1.0/
1.1 & 1.2
- https://api.wordpress.org/plugins/update-check/1.1/
- https://api.wordpress.org/plugins/info/1.2/?{params} – see docs
- https://api.wordpress.org/plugins/info/1.2/?action=query_plugins&request[author]={author_slug}
The main difference is that 1.1 uses JSON by default, where as 1.0 used PHP Serialized by default. The 1.2 Info endpoints only accepts GET requests, and includes a different set of default fields - as used by WordPress 5.0+.
Note: You can find information about arguments and examples in the following blog articles:
- v1.2: https://wplake.org/blog/wordpress-org-api/
- v1.0: http://wp.tutsplus.com/tutorials/plugins/communicating-with-the-wordpress-org-plugin-api/
- v1.0: http://dd32.id.au/projects/wordpressorg-plugin-information-api-docs/
Block Patterns
Patterns from the Block Pattern Directory. Also used in Gutenberg's Inserter control.
- Browse all: https://api.wordpress.org/patterns/1.0/
- Browse by Category: https://api.wordpress.org/patterns/1.0/?pattern-categories=2 (where `2` is the category ID)
- Search: https://api.wordpress.org/patterns/1.0/?search=button (where `button` is the search term)
- Core patterns: https://api.wordpress.org/patterns/1.0/?wp-version=5.8&pattern-keywords=11&locale=en_US&search=button (`11` is the keyword for Core patterns)
- Translations: https://api.wordpress.org/patterns/1.0/?wp-version=5.8&pattern-keywords=11&locale=es_MX&search=Contacto (specify `locale`. `en_US` patterns will be included when a pattern isn't translated to that locale yet.)
Popular Import Plugin
List of popular import plugins in the WordPress Plugin Directory used by Tools → Import Screen.
- https://api.wordpress.org/core/importers/1.0/ (serialized)
- https://api.wordpress.org/core/importers/1.1/ (JSON)
Checksum
Returns a JSON encoded array of file MD5 checksums for a given WordPress release / locale. Although english is the default, it's suggested to pass it for 100% compatibility with core.
Note that MD5 hashes are not cryptographically secure and should not be relied on to detect malicious changes to WordPress files.
Editor
Used by the theme and plugin editor to get a reference to documentation generated with phpDocumentor.
- https://api.wordpress.org/core/handbook/1.0/?function={function}&version={wp-version}&redirect=true (where FUNCTION is the name of the function to lookup, VERSION is the WordPress version to look it up for, and redirect determines whether the redirect happens automatically.)
Events
Upcoming WordCamps and meetup events, filterable by location.
- https://api.wordpress.org/events/1.0
- https://api.wordpress.org/events/1.0/?number=3
- https://api.wordpress.org/events/1.0/?location=Seattle
- https://api.wordpress.org/events/1.0/?locale=de_DE&timezone=Europe/Berlin&location=Dresden
- https://api.wordpress.org/events/1.0/?location=Australia
- https://api.wordpress.org/events/1.0/?latitude=51.051&longitude=13.738
- https://api.wordpress.org/events/1.0/?ip=136.0.16.1
- https://api.wordpress.org/events/1.0/?country=IT
The date and end_date fields in the response are in the event's local timezone, not UTC.