0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

wp-env ( WSL2+Docker ) 環境構築

Last updated at Posted at 2025-09-30

概要

  • WordPress 6.6 にクラシックテーマを開発します。
  • テーマは 2025 (Twenty twenty Five) 。

インストール設定

.bash
mkdir wpenv66
cd ./wpenv66
nano ./.wp-env.json
.wp-env.json
{
    "core": "WordPress/WordPress#6.6.3",
    
    "plugins": [ "WordPress/classic-editor" ],
    "themes": [ "WordPress/<your-desirable-theme>" ],
    "port": 6661,
    "env": {
        "tests": {
            "port": 6662
        }
    },
    "phpVersion": "8.1"
}

  • 重要な項目
項目 説明
"core" 使用するWordPressインストール。
"plugins" 環境にインストールして有効にするプラグインのリスト。
"themes" 環境にインストールするテーマのリスト。
"port" 開発環境の Web サーバーのポートをオーバーライドします。
env.tests.port テスト環境の Web サーバーのポートを上書きします。
"phpVersion" 特定のPHPバージョン (At the least the oldest PHP version which the theme supports, in X.X format, only the number)
  • 必要に応じて
項目 説明
"phpmyadminPort" The port number for phpMyAdmin. If provided, you’ll access phpMyAdmin through: http://localhost:
"multisite" Whether to set up a multisite installation.

.wp-env.json /themes の slug

グローバルスタイルのstyle.css と同じく↓

Twenty Twenty Five のインストールディレクトリを GitHub のソース見て確認しようと思ったが。なんかリードオンリー (アーカイブ化 ) されているので最新じゃないけど。アーカイブ名は twentytwentyfive なのでこいつにしよう。

    "themes": [ "WordPress/twentytwentyfive" ]
  • そもそも Default theme は .wp-env.json のthemes に指定不要?

PHP バージョン (wp-env.json)

6.6 のリリースに際しての、以下のブリーフィングをみたところ、PHP 8.2 の utf8_encode() やutf8_decode() の非推奨化への対応が見送られています。この PHP の仕様の変化は、Updraft Plus, Ninja Forms, Elementor などのプラグインに影響します。

上記リンク先にも書いてありましたが、1年間、PHP8 は セキュリティサポートが延長され、8.1 が 2026 2025年 いっぱいはサポート されます。

今回は、とあるチュートリアルサイトでクラシックテーマとブロックテーマの移行関連のために、一時的に WordPress 6.6 が必要なだけだったので、PHP 8.1 をインストール したいと思います。

  • ちなみに Twenty Twenty Five がサポートする the oldest PHP version は 7.2。

2025/10/9 追記

別の機会に以下のリンクを見つけました。PHP 8.2 は 2026 年いっぱいまで セキュリティサポートがあります。もう 1年くらい使用する場合、8.2 がいいと思います。

ただし、PHP 8.2 での utf8_encode() やutf8_decode() の非推奨化へは WordPress 6.6 では対応されていないので、6.7 以降を別途検討されるべきです。

参考

  • wp-env

  • About Plugin(s)

インストール

.bash
npm -g i @wordpress/env

起動

.bash
wp-env start
WordPress development site started at http://localhost:6661
WordPress test site started at http://localhost:6662
MySQL is listening on port 32769
MySQL for automated testing is listening on port 32770

 ✔ Done! (in 262s 966ms)

http://localhost:6661
にアクセスします。

スクリーンショット 2025-09-30 170311.png

トラブルシューティング

存在しない WordPress Coreをインストールしようとしている場合
.wp-env.json"core": "WordPress/WordPress#6.6.0 としたとします。

その設定で wp-env start するとこうなります:

.bash
wp-env start
✖ fatal: couldn't find remote ref 6.6.0

GitError: fatal: couldn't find remote ref 6.6.0

Choose correct WordPress Core from its tag in:

And paste it to your .wp-env.json ( In this case 6.6.3 shown below:

スクリーンショット 2025-09-30 165656.png

Then wp-env start again.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?