https://github.com/robertdevore/wpcom-check
A utility to handle WordPress.com-specific plugin compatibility and auto-deactivation.
https://github.com/robertdevore/wpcom-check
Last synced: 10 months ago
JSON representation
A utility to handle WordPress.com-specific plugin compatibility and auto-deactivation.
- Host: GitHub
- URL: https://github.com/robertdevore/wpcom-check
- Owner: robertdevore
- License: mit
- Created: 2025-01-03T02:59:36.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-04T02:21:25.000Z (12 months ago)
- Last Synced: 2025-03-24T05:40:30.809Z (10 months ago)
- Language: PHP
- Size: 6.84 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WPCom Check
WPCom Check is a WordPress® utility designed to ensure compatibility with WordPress.com-hosted environments.
It provides automated plugin deactivation and user notifications if a plugin is not supported on WordPress.com.
This tool is ideal for plugin developers who want to ensure their plugins gracefully handle unsupported hosting environments.
## Features
- Automatically detects if the site is hosted on WordPress.com.
- Deactivates the plugin if unsupported.
- Displays an admin notice with information about the deactivation.
- Prevents activation on unsupported environments.
- Allows developers to provide a custom learn-more link for user education.
## Installation
### Using Composer
Add the package to your project:
```
composer require robertdevore/wpcom-check
```
Include Composer's autoload file in your plugin or theme:
```
if ( ! class_exists( 'RobertDevore\WPComCheck\WPComPluginHandler' ) ) {
require_once __DIR__ . '/vendor/autoload.php';
}
```
Instantiate the `WPComPluginHandler` class in your plugin's main file:
```
use RobertDevore\WPComCheck\WPComPluginHandler;
new WPComPluginHandler( plugin_basename( __FILE__ ), 'https://domain.com/learn-more/' );
```
### Manual Installation
Clone or download the repository from GitHub:
```
git clone https://github.com/robertdevore/wpcom-check.git
```
Include the `WPComPluginHandler.php` file in your project:
```
if ( ! class_exists( 'RobertDevore\WPComCheck\WPComPluginHandler' ) ) {
require_once __DIR__ . '/vendor/autoload.php';
}
```
Instantiate the class in your plugin's main file:
```
use RobertDevore\WPComCheck\WPComPluginHandler;
new WPComPluginHandler( plugin_basename( __FILE__ ), 'https://domain.com/learn-more/' );
```
## Usage
### Parameters
- `**$pluginSlug**`: (string) The plugin slug, typically obtained using `plugin_basename(__FILE__)`.
- `**$learnMoreLink**`: (string) A URL pointing to more information about the deactivation reason or alternative solutions.
### Example
Here is how to use WPCom Check in your plugin:
```