Skip to content

Latest commit

 

History

History
112 lines (70 loc) · 5.54 KB

File metadata and controls

112 lines (70 loc) · 5.54 KB

HWP Previews

Headless Previews solution for WordPress: fully configurable preview URLs via the settings page which is framework agnostic.


Version License GitHub forks GitHub stars Testing Integration Code Coverage Code Quality End-to-End Tests


Overview

HWP Previews is a robust and extensible WordPress plugin that centralizes all preview configurations into a user-friendly settings interface. It empowers site administrators and developers to tailor preview behaviors for each public post type independently, facilitating seamless headless or decoupled workflows. With HWP Previews, you can define dynamic URL templates, allow posts of all statuses to be used as parents, and extend functionality through flexible hooks and filters, ensuring a consistent and conflict-free preview experience across diverse environments.

Motivation

In traditional WordPress, previewing content is straightforward: clicking the "Preview" button shows you a draft version of your post on the same WordPress site. However, in headless WordPress architectures, where the front-end is decoupled from WordPress, this simple mechanism breaks down. The front-end application lives on a different domain, knows nothing about WordPress authentication, and cannot automatically access unpublished content.

This fundamental architectural shift creates what we call the "preview problem" in headless WordPress. HWP Previews was created to bridge this gap, providing a centralized, framework-agnostic solution to preview management.

Features

  • Enable/Disable Previews: Turn preview functionality on or off for each public post type (including custom types).
  • Custom URL Templates: Define preview URLs using placeholder tokens for dynamic content.
  • Parent Status: Allow posts of all statuses to be used as parents within hierarchical post types.
  • Highly Customizable: Extend core behavior with a comprehensive set of actions and filters.
  • Faust Compatibility: The plugin is compatible with Faust.js and the FaustWP plugin.

Note

For Faust users, HWP Previews integrates seamlessly, automatically configuring settings to match Faust's preview system. This allows you to maintain your existing preview workflow without additional setup.

Requirements

  • WordPress 6.0+
  • PHP 7.4+

Installation

Option 1: Plugin Zip

You can get the latest release here - https://github.com/wpengine/hwptoolkit/releases/latest/download/hwp-previews.zip

You can also download it from our release page - https://github.com/wpengine/hwptoolkit/releases

Option 2: Composer

To install, you need to follow our guide here to install the plugin via composer - https://github.com/wpengine/hwptoolkit/blob/main/docs/how-to/install-toolkit-plugins/index.md

Once you have the composer repository setup, please run composer req wpengine/hwp-previews:* to install the plugin.

Documentation

For detailed usage instructions, developer references, and examples, visit our comprehensive documentation:

Testing

See Testing.md for details on how to test the plugin.

Uninstallation

By default, HWP Previews preserves all settings when the plugin is deactivated to prevent accidental data loss.

If you would like to remove all plugin settings and data, you must set the PHP constant before you uninstall the plugin:

define( 'HWP_PREVIEWS_UNINSTALL_PLUGIN', true );

You can add this constant to your wp-config.php file if you want to enable automatic cleanup during uninstallation.

Screenshots

Click to expand screenshots

Custom Post Type Preview Preview settings page.

Custom Post Type Preview Preview settings for a custom post type.

Post Preview Preview button in the WordPress editor.

Post Preview in Iframe Preview loaded inside the WordPress editor using an iframe.

Preview Token Preview token parameter for secure preview URLs.

App Password App password setup for authentication.

License

WP GPL 2