https://github.com/wp-forge/wp-update-handler
A WordPress package for updating custom plugins and themes based on an API response from a custom update server.
https://github.com/wp-forge/wp-update-handler
hacktoberfest
Last synced: about 1 year ago
JSON representation
A WordPress package for updating custom plugins and themes based on an API response from a custom update server.
- Host: GitHub
- URL: https://github.com/wp-forge/wp-update-handler
- Owner: wp-forge
- Created: 2021-09-29T19:29:19.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-02-16T18:08:16.000Z (over 2 years ago)
- Last Synced: 2025-04-11T05:09:06.829Z (about 1 year ago)
- Topics: hacktoberfest
- Language: PHP
- Homepage:
- Size: 20.5 KB
- Stars: 12
- Watchers: 4
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WordPress Update Handler
A WordPress package for updating custom plugins and themes based on an JSON REST API response from a custom update
server.
Check out the [WordPress GitHub Release API](https://github.com/wp-forge/worker-wp-github-release-api) repository to
learn how to quickly launch a custom update server that fetches releases from GitHub using Cloudflare Workers.
## Plugins
This package expects your custom plugin info API to respond with the same shape as
the [WordPress plugin info API](https://codex.wordpress.org/WordPress.org_API#Plugins). However, if your API response
has a different shape, you can map fields to those returned by your API.
### Usage
Basic example:
```php
setDataMap(
[
'requires' => 'requires.wp',
'requires' => 'requires.php',
'banners.2x' => 'banners.retina',
]
);
/*
* Explicitly set specific values that will be provided to WordPress.
*/
$pluginUpdater->setDataOverrides(
[
'banners' => [
'2x' => 'https://my.cdn.com/banner-123-retina.jpg',
'1x' => 'https://my.cdn.com/banner-123.jpg',
],
'icons' => [
'2x' => 'https://my.cdn.com/icon-123-retina.jpg',
'1x' => 'https://my.cdn.com/icon-123.jpg',
],
]
);
```
## Themes
This package expects your custom theme info API to respond with the same shape as
the [WordPress theme info API](https://codex.wordpress.org/WordPress.org_API#Themes). However, if your API response has
a different shape, you can map fields to those returned by your API.
### Usage
Basic example:
```php
setDataMap(
[
'requires' => 'requires.wp',
'requires' => 'requires.php',
'banners.2x' => 'banners.retina',
]
);
/*
* Explicitly set specific values that will be provided to WordPress.
*/
$themeUpdater->setDataOverrides(
[
'banners' => [
'2x' => 'https://my.cdn.com/banner-123-retina.jpg',
'1x' => 'https://my.cdn.com/banner-123.jpg',
],
'icons' => [
'2x' => 'https://my.cdn.com/icon-123-retina.jpg',
'1x' => 'https://my.cdn.com/icon-123.jpg',
],
]
);
```