Download the PHP package robertdevore/wpcom-check without Composer
On this page you can find all versions of the php package robertdevore/wpcom-check. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download robertdevore/wpcom-check
More information about robertdevore/wpcom-check
Files in robertdevore/wpcom-check
Package wpcom-check
Short Description A utility to handle WordPress.com-specific plugin compatibility and auto-deactivation.
License MIT
Homepage https://github.com/robertdevore/wpcom-check
Informations about the package 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
- 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:
Include Composer's autoload file in your plugin or theme:
Instantiate the WPComPluginHandler
class in your plugin's main file:
Manual Installation
Clone or download the repository from GitHub:
Include the WPComPluginHandler.php
file in your project:
Instantiate the class in your plugin's main file:
Usage
Parameters
**$pluginSlug**
: (string) The plugin slug, typically obtained usingplugin_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:
How It Works
-
Detection: The
WPComPluginHandler
checks if the site is hosted on WordPress.com by inspecting theIS_WPCOM
constant. -
Deactivation: If the plugin is running in an unsupported environment, it is deactivated automatically.
-
Admin Notice: An admin notice is displayed, providing users with a link to learn more about the issue.
- Activation Prevention: The plugin prevents itself from being activated on unsupported environments, displaying a detailed error message.
Developer Notes
- Ensure you use the correct plugin slug when instantiating the class.
- Customize the learn-more link to provide users with appropriate guidance.
- Use Composer for a streamlined installation and updates.
Contributing
Contributions are welcome! Please fork the repository and submit a pull request with your improvements.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Support
For questions or issues, please create a GitHub issue at github.com/robertdevore/wpcom-check.