PHPackages                             robertdevore/wpcom-check - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. robertdevore/wpcom-check

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

robertdevore/wpcom-check
========================

A utility to handle WordPress.com-specific plugin compatibility and auto-deactivation.

1.0.1(1y ago)6631MITPHPPHP &gt;=7.4

Since Jan 3Pushed 1y ago1 watchersCompare

[ Source](https://github.com/robertdevore/wpcom-check)[ Packagist](https://packagist.org/packages/robertdevore/wpcom-check)[ Docs](https://github.com/robertdevore/wpcom-check)[ RSS](/packages/robertdevore-wpcom-check/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

WPCom Check
===========

[](#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
--------

[](#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
------------

[](#installation)

### Using Composer

[](#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

[](#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
-----

[](#usage)

### Parameters

[](#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

[](#example)

Here is how to use WPCom Check in your plugin:

```
