A WordPress plugin that provides a WP-CLI command to render a WordPress URL path and output the raw HTML, HTTP status code or the URL itself. It includes an optional flag to exclude specific plugins from the request, useful for debugging or performance testing.
The Render Command plugin adds a wp render command to WP-CLI, allowing you to render a WordPress page by specifying its URL path. The plugin supports excluding specific plugins during the request using the --without-plugins flag, which can help isolate issues or test performance without certain plugins.
When activated, the plugin creates a must-use (mu-plugin) file to handle plugin exclusion logic via secure query parameters. This mu-plugin is automatically removed upon deactivation. You can also use the --link flag to generate and output the URL (including exclusion parameters) without actually making the HTTP request.
Download the plugin from GitHub or install and activate using WP-CLI:
wp plugin install https://github.com/austinginder/render-command/releases/latest/download/render-command.zip --activate --forceThe plugin provides the following WP-CLI command:
wp render <path> [--without-plugins[=<plugins>]] [--format=<format>] [--link]<path>: The URL path to render (e.g.,/about-us/).[--without-plugins[=<plugins>]]: Exclude plugins for the request. If the flag is provided without a value, all plugins are excluded. If a comma-separated list of plugin slugs is provided (e.g.,jetpack,wordpress-seo), only those specific plugins are excluded. Requires a validAUTH_SALTdefined inwp-config.php. This option modifies the URL generated when used with--link.[--format=<format>]: Determine the output format when making the request (ignored if--linkis used).raw(default): Outputs the full HTML response body.http_code: Outputs only the HTTP status code (e.g.,200,404).
[--link]: If present, output the generated URL (including any exclusion parameters) instead of making the HTTP request.
-
Render the homepage:
wp render "/" -
Render an about page excluding the
jetpackandwordpress-seoplugins:wp render "/about-us/" --without-plugins="jetpack,wordpress-seo"
-
Render a contact page excluding all plugins:
wp render "/contact" --without-plugins -
Get only the HTTP status code for the shop page, excluding all plugins:
wp render "/shop" --without-plugins --format=http_code -
Output the URL that would be requested for the products page, excluding all plugins, without making the request:
wp render "/products" --without-plugins --link
- Plugin Exclusion: The
--without-pluginsflag adds secure query parameters (exclude_pluginsandexclusion_token) to the request URL. The mu-plugin validates the token (based onAUTH_SALT) and filters theoption_active_pluginshook to exclude plugins based on their slugs for that specific request only. - MU-Plugin: On activation, the plugin creates an mu-plugin (
render-command.php) in the/wp-content/mu-plugins/directory to handle plugin exclusion logic. This file is removed on deactivation. - Output: The command outputs the raw HTML, HTTP status code, or the generated URL to the terminal based on the provided flags (
--format,--link).
- WordPress 5.0 or higher
- WP-CLI 2.0 or higher
- PHP 7.4 or higher
This plugin is licensed under the MIT License.
- Austin Ginder
- Website: austinginder.com
- GitHub: github.com/austinginder
Contributions are welcome! Please submit issues or pull requests on the GitHub repository.
- Added
--linkflag to output the generated URL (including exclusion parameters) instead of making the HTTP request.
- Added
--without-pluginsflag without value to exclude all plugins for the request (e.g.,wp render "/" --without-plugins). - Introduced
--formatoption to control output format:raw(default): Outputs the full HTML response.http_code: Outputs only the HTTP status code (e.g.,200,404).
- Added request timeout:
- Set a 120-second timeout for
wp_remote_getto handle slow responses. - Disabled SSL verification (
sslverify => false) for flexibility in local or testing environments.
- Set a 120-second timeout for
- Initial release with
wp rendercommand and plugin exclusion functionality. - Added --without-plugins= flag for excluding specific plugins via comma-separated slugs.
- Implemented MU-plugin for handling exclusion logic based on exclude_plugins and exclusion_token query parameters.