You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/plugins/hwp-previews/explanation/actions-and-filters/index.md
+3-14Lines changed: 3 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,10 @@
1
-
# Actions & Filters
2
-
3
-
## Table of Contents
4
-
5
-
-[PHP Actions](#php-actions)
6
-
-[PHP Filters](#php-filters)
7
-
-[Examples](#examples)
8
-
-[Actions](#actions)
9
-
-[Filters](#filters)
10
-
-[Contributing](#contributing)
11
-
1
+
---
2
+
title: "Actions and Filters"
3
+
description: "Learn about the available PHP actions and filters in HWP Previews plugin for customizing plugin behavior, settings, and integrations."
12
4
---
13
5
14
6
This document lists the available PHP actions and filters provided by the HWP Previews plugin, along with explanations and usage examples. These hooks allow you to customize plugin behavior, settings, and integration with other plugins or your theme.
15
7
16
-
---
17
8
18
9
## PHP Actions
19
10
@@ -25,7 +16,6 @@ This document lists the available PHP actions and filters provided by the HWP Pr
25
16
|`hwp_previews_settings_init`| Fired after the settings page is initialized. |
26
17
|`hwp_previews_settings_form_manager_init`| Fired after the settings form manager is initialized. |
27
18
28
-
---
29
19
30
20
## PHP Filters
31
21
@@ -39,7 +29,6 @@ This document lists the available PHP actions and filters provided by the HWP Pr
39
29
|`hwp_previews_filter_available_post_types`| Filter the available post types for previews (affects settings UI and preview logic). |
40
30
|`hwp_previews_filter_available_post_statuses`| Filter the available post statuses for previews. |
Copy file name to clipboardExpand all lines: docs/plugins/hwp-previews/index.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -119,6 +119,18 @@ To implement previews from scratch, refer to your framework's documentation:
119
119
120
120
HWP Previews automatically integrates with [Faust.js](https://faustjs.org/) when both plugins are active. See the [Integrate with Faust.js](how-to/integrate-with-faust/index.md) guide for details.
121
121
122
+
## Uninstallation
123
+
124
+
By default, HWP Previews preserves all settings when the plugin is deactivated to prevent accidental data loss.
125
+
126
+
If you would like to remove all plugin settings and data, you must set the PHP constant before you uninstall the plugin:
127
+
128
+
```php
129
+
define( 'HWP_PREVIEWS_UNINSTALL_PLUGIN', true );
130
+
```
131
+
132
+
You can add this constant to your `wp-config.php` file if you want to enable automatic cleanup during uninstallation.
133
+
122
134
## Contributing
123
135
124
136
If you feel like something is missing or you want to add documentation, we encourage you to contribute! Please check out our [Contributing Guide](https://github.com/wpengine/hwptoolkit/blob/main/CONTRIBUTING.md) for more details.
Copy file name to clipboardExpand all lines: plugins/hwp-previews/CHANGELOG.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,17 @@
1
1
# HWP Previews
2
2
3
+
## 0.0.14
4
+
5
+
### Patch Changes
6
+
7
+
-[#525](https://github.com/wpengine/hwptoolkit/pull/525)[`a120c89`](https://github.com/wpengine/hwptoolkit/commit/a120c899d6f8fe2b11ec122e142da24d7859dbda) Thanks [@ahuseyn](https://github.com/ahuseyn)! - Add optional data cleanup on uninstall via HWP_PREVIEWS_UNINSTALL_PLUGIN constant
8
+
9
+
## 0.0.13
10
+
11
+
### Patch Changes
12
+
13
+
-[#519](https://github.com/wpengine/hwptoolkit/pull/519)[`0dff8ff`](https://github.com/wpengine/hwptoolkit/commit/0dff8fff953767fd33c2a864909955b28a620b75) Thanks [@ahuseyn](https://github.com/ahuseyn)! - Changed documentation links on wp-admin
Copy file name to clipboardExpand all lines: plugins/hwp-previews/examples/hwp-preview-rest/README.md
+28-23Lines changed: 28 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,26 @@
1
-
# Example: Headless WordPress Previews with Nextjs App Router and REST API
1
+
---
2
+
title: "Headless WordPress Previews with Next.js App Router and REST API"
3
+
description: "This demonstrates the usage of HWP Previews with Next.js App Router and REST API. It uses JWT authentication to fetch posts in draft status and implements a login modal for front-end authentication, showcasing an alternative approach to the Draft Mode implementation."
4
+
---
5
+
6
+
# Example: Headless WordPress Previews with Next.js App Router and REST API
2
7
3
8
> [!NOTE]
4
-
> Check out [HWP Previews WPGraphQL example](../hwp-preview-wpgraphql) if you need the previews implementation with Nextjs pages router, Draft Mode or WordPress Application Passwords.
9
+
> Check out [HWP Previews WPGraphQL example](../hwp-preview-wpgraphql) if you need the previews implementation with Next.js pages router, Draft Mode or WordPress Application Passwords.
5
10
6
11
## Overview
7
12
8
-
The purpose of this example is to showcase different use cases of HWP Previews. The example demonstrates the usage of [HWP Previews](https://github.com/wpengine/hwptoolkit/tree/main/plugins/hwp-previews) with Nextjs App Router and REST API. Example uses credentials authentication to fetch the posts in draft status. Unlike [HWP Previews WPGraphQL example](../hwp-preview-wpgraphql) this example don't use [Draft Mode](https://nextjs.org/docs/pages/guides/draft-mode).
13
+
The purpose of this example is to showcase different use cases of HWP Previews. The example demonstrates the usage of [HWP Previews](https://github.com/wpengine/hwptoolkit/tree/main/plugins/hwp-previews) with Next.js App Router and REST API. Example uses credentials authentication to fetch the posts in draft status. Unlike [HWP Previews WPGraphQL example](../hwp-preview-wpgraphql) this example doesn't use [Draft Mode](https://nextjs.org/docs/pages/guides/draft-mode).
9
14
10
15
The example includes a wp-env setup, which will allow you to build and start this example quickly. With this wp-env setup, you don't need to have a separate WordPress instance or demo data to inspect the example.
11
16
12
-
> [!CAUTION]
13
-
> The HWP Previews plugin is currently in beta. While it's more stable than earlier versions, you may still encounter occasional bugs or incomplete features. Regular updates will continue as development progresses. Use with care and consider providing feedback to help improve the plugin.
17
+
## What does this example do
18
+
19
+
1. Preview posts, pages and custom post types using WordPress REST API
20
+
2. Use JWT authentication for secure access to draft content
21
+
3. Next.js App Router implementation without Draft Mode
22
+
4. Login modal for front-end authentication
23
+
5. Configured WordPress instance with demo data and required plugins, using wp-env.
14
24
15
25
## Screenshots
16
26
@@ -52,47 +62,42 @@ The example includes a wp-env setup, which will allow you to build and start thi
52
62
53
63
**Note** Please make sure you have all prerequisites installed as mentioned above and Docker running (`docker ps`)
54
64
55
-
### Setup Repository and Packages
65
+
### 1. Setup Repository and Packages
56
66
57
67
- Clone the repo `git clone https://github.com/wpengine/hwptoolkit.git`
> **Note:** The login details for the admin is username "admin" and password "password"
78
85
79
-
### Add environment variable to the Nextjs
80
-
81
-
Create a .env file under `examples/next/hwp-preview-rest/example-app` and add copy-paste the environment variable below:
86
+
### 3. Add environment variable to the Next.js application
82
87
88
+
Create a .env file under `plugins/hwp-previews/examples/hwp-preview-rest/example-app` and add the environment variable below:
83
89
84
90
```bash
85
91
NEXT_PUBLIC_WORDPRESS_URL=http://localhost:8888
86
92
```
87
93
88
-
### Usage
94
+
> [!CAUTION]
95
+
> This setup is intended for demonstration purposes only. For production use, you should consider the security implications and implement appropriate measures based on your project's specific needs.
89
96
90
-
After completing this step, login to your [WordPress instance](http://localhost:8888) and preview the posts as usual. Since all of the settings are configured for this example, clicking the preview button should redirect you to the front-end URL. To see the draft posts and pages you will need to login your WordPress account on front-end website, using the same credentials.
91
97
92
-
If you want to learn more about the preview plugin, check out [the documentation](/plugins/hwp-previews/README.md).
98
+
After completing this step, clicking the preview button in wp-admin should open the preview in your front-end app. Login with your admin credentials on the frontend to enable draft preview functionality.
93
99
94
-
> [!CAUTION]
95
-
> This setup is intended for demonstration purposes only. For production use, you should consider the security implications and implement appropriate measures based on your project’s specific needs.
100
+
If you want to learn more about the preview plugin, check out [the documentation](../../../../docs/plugins/hwp-previews/index.md).
Copy file name to clipboardExpand all lines: plugins/hwp-previews/examples/hwp-preview-wpgraphql/README.md
+19-21Lines changed: 19 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,23 @@
1
+
---
2
+
title: "Headless WordPress Previews with Next.js Pages Router and WPGraphQL"
3
+
description: "This demonstrates the usage of HWP Previews with Next.js Pages Router and WPGraphQL. It uses WordPress Application Passwords for authentication and implements Draft Mode for secure preview functionality."
4
+
---
5
+
1
6
# Example: Headless WordPress Previews with Nextjs Draft Mode
2
7
3
8
## Overview
4
9
5
-
This example shows the HWP Previews plugin in action. Example implements the [Draft Mode](https://nextjs.org/docs/pages/guides/draft-mode) of Nextjs. It uses WordPress [Application Passwords](https://wordpress.com/support/security/two-step-authentication/application-specific-passwords/) for the authentication and WPGraphQL for data fetching.
10
+
This example shows the HWP Previews plugin in action. Example implements the [Draft Mode](https://nextjs.org/docs/pages/guides/draft-mode) of Next.js. It uses WordPress [Application Passwords](https://wordpress.com/support/security/two-step-authentication/application-specific-passwords/) for the authentication and WPGraphQL for data fetching.
6
11
7
12
The example includes a wp-env setup, which will allow you to build and start this example quickly. With this wp-env setup, you don't need to have a separate WordPress instance or demo data to inspect the example.
8
13
9
-
> [!CAUTION]
10
-
> The HWP Previews plugin is currently in an beta state. It's still under active development, so you may encounter bugs or incomplete features. Updates will be rolled out regularly. Use with caution and provide feedback if possible.
11
-
12
14
## What does this example do
13
15
14
-
1.`/api/preview/` route to enable Nextjs Draft Mode
15
-
2.`/api/disable-preview` route to disable Nextjs Draft Mode
16
+
1.`/api/preview/` route to enable Next.js Draft Mode
17
+
2.`/api/disable-preview` route to disable Next.js Draft Mode
16
18
3. Preview posts, pages and custom post types
17
19
4. Use WordPress Application Password as an authentication method
18
-
5. Configured WordPress instance with demo data and required plugins, using wp-env
20
+
5. Configured WordPress instance with demo data and required plugins, using wp-env.
19
21
20
22
## Screenshots
21
23
@@ -55,34 +57,30 @@ The example includes a wp-env setup, which will allow you to build and start thi
55
57
56
58
**Note** Please make sure you have all prerequisites installed as mentioned above and Docker running (`docker ps`)
57
59
58
-
### Setup Repository and Packages
60
+
### 1. Setup Repository and Packages
59
61
60
62
- Clone the repo `git clone https://github.com/wpengine/hwptoolkit.git`
> **Note:** The login details for the admin is username "admin" and password "password"
82
80
83
-
### Add environment variables to the Nextjs
81
+
### 3. Add environment variables to the Nextjs
84
82
85
-
In this step we will create an Application Password and a secret preview token for the previews. At the end we'll prepare a .env file for the Nextjs application and put it inside `examples/next/hwp-preview-wpgraphql/example-app` folder. Below are the step by step guide to achieve this.
83
+
In this step we will create an Application Password and a secret preview token for the previews. At the end we'll prepare a .env file for the Next.js application and put it inside `plugins/hwp-previews/examples/hwp-preview-wpgraphql/example-app` folder. Below are the step by step guide to achieve this.
86
84
87
85
1. Login to your newly created [wp-env instance](http://localhost:8888/wp-admin/). You can find the credentials above
88
86
2. a. Follow [these instructions](https://wordpress.com/support/security/two-step-authentication/application-specific-passwords/) to create an Application Password. At the end it should look like this:
@@ -95,7 +93,7 @@ In this step we will create an Application Password and a secret preview token f
0 commit comments