Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ Go to `https://localhost`, and enjoy!
- [Create static binaries](https://frankenphp.dev/docs/static/)
- [Compile from sources](https://frankenphp.dev/docs/compile/)
- [Monitoring FrankenPHP](https://frankenphp.dev/docs/metrics/)
- [WordPress integration](https://frankenphp.dev/docs/wordpress/)
- [Laravel integration](https://frankenphp.dev/docs/laravel/)
- [Known issues](https://frankenphp.dev/docs/known-issues/)
- [Demo app (Symfony) and benchmarks](https://github.com/dunglas/frankenphp-demo)
Expand Down
57 changes: 57 additions & 0 deletions docs/wordpress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# WordPress

Run [WordPress](https://wordpress.org/) with FrankenPHP to enjoy a modern, high-performance stack with automatic HTTPS, HTTP/3, and Zstandard compression.

## Minimal Installation

1. [Download WordPress](https://wordpress.org/download/)
2. Extract the ZIP archive and open a terminal in the extracted directory
3. Run:
```console
frankenphp php-server
```
4. Go to `http://localhost/wp-admin/` and follow the installation instructions
5. Enjoy!

For a production-ready setup, prefer using `frankenphp run` with a `Caddyfile` like this one:

```caddyfile
example.com
php_server
encode zstd br gzip
log
```

## Hot Reload

To use the [hot reload](hot-reload.md) feature with WordPress, enable [Mercure](mercure.md) and add the `hot_reload` sub-directive to the `php_server` directive in your `Caddyfile`:

```caddyfile
localhost
mercure {
anonymous
}
php_server {
hot_reload
}
```

Then, add the code needed to load the JavaScript libraries in the `functions.php` file of your WordPress theme:

```php
function hot_reload() {
?>
<?php if (isset($_SERVER['FRANKENPHP_HOT_RELOAD'])): ?>
<meta name="frankenphp-hot-reload:url" content="<?=$_SERVER['FRANKENPHP_HOT_RELOAD']?>">
<script src="https://cdn.jsdelivr.net/npm/idiomorph"></script>
<script src="https://cdn.jsdelivr.net/npm/frankenphp-hot-reload/+esm" type="module"></script>
<?php endif ?>
<?php
}
add_action('wp_head', 'hot_reload');
```

Finally, run `frankenphp run` from the WordPress root directory.