WordPress5.6 をチェックしています

WordPress5.6 をチェックしています

WordPress5.6 RC1 が 公開されました。 WordPress5.6は 2020年12月8日に リリースされる予定なので いろいろチェックをしています。
その中の WordPress5.6 で気がついたところを取り上げていきます。
これから追加・変更があるかもですので、説明や画像等がリリース時と違う場合もありますが随時チェックしていく予定です。

リリースまでのスケジュールは WordPress 5.6 Development Cycle に載っています。

WordPress 5.6 Beta1 https://wordpress.org/news/2020/10/wordpress-5-6-beta-1/
WordPress 5.6 Beta2 https://wordpress.org/news/2020/10/wordpress-5-6-beta-2/
WordPress 5.6 Beta3 https://wordpress.org/news/2020/11/wordpress-5-6-beta-3/
WordPress 5.6 Beta4 https://wordpress.org/news/2020/11/wordpress-5-6-beta-4/
WordPress 5.6 RC1 https://wordpress.org/news/2020/11/wordpress-5-6-release-candidate/
WordPress 5.6 RC2 https://wordpress.org/news/2020/12/wordpress-5-6-release-candidate-2/

【2020/12/09追記】
WordPress 5.6 リリースされました。
WordPress5.6「Simone」」 https://wordpress.org/news/2020/12/simone/

 

Gutenbergブロックエディタ

WordPress5.5では「Gutenbergプラグインver8.5」でしたが WordPress5.6では「Gutenbergプラグイン(ver9.2)」が組み込まれました。

Gutenbergの過去のバージョンの記事を見る事で 何が変更して追加されたか を見る事ができます。
グーテンベルクの新機能 (10月21日) v9.2
グーテンベルクの新機能 (9月30日)v9.1
グーテンベルクの新機能 (9月16日)v9.0
グーテンベルクの新機能 (9月2日) v8.9
グーテンベルクの新機能 (8月19日) v8.8
グーテンベルクの新機能 (8月5日) v8.7
グーテンベルクの新機能 (7月22日) v8.6

 

ブロックパターンカテゴリに絞り込み用セレクトボックスを追加

ブロックパターンはカテゴリごとに分類されていますが、全部 表示されており目的ブロックパターンを探すのに 結構スクロールしないといけませんでした。

WordPress5.6 からは カテゴリごとに整理され、絞り込み用セレクトボックスで選択したブロックパターンだけを表示するようになり、スッキリしました。

WordPress5.6 ブロックパターンカテゴリ

【参考】Inserter: Add block pattern category selection dropdown in main inserter #24954
https://github.com/WordPress/gutenberg/pull/24954

 

情報パネルに「文字数」を追加

情報パネルは「単語」「見出し」「段落」「ブロック」の数を表示していましたが 今回「文字数」が追加されました。

WordPress5.6 情報パネル

【参考】Add character count to info panel #24823
https://github.com/WordPress/gutenberg/pull/24823

 

埋め込み(embed)ブロック

埋め込み(embed)ブロックが追加されました。

WordPress5.6 埋め込み(embed)ブロック
URLを入れるだけでブログカードのように表示されます。
※入れたURLのサイトが対応していないと使えません。

【参考】オブジェクトの埋め込み
https://ja.wordpress.org/support/article/embeds/

 

カバーブロック

背景画像では「焦点ピッカー」が使えていたのですが 今回のWordPress5.6ではビデオ背景の位置も調整できるようになりました。

WordPress5.6 カバーブロック

【参考】Cover: Video – Add position controls #22531
https://github.com/WordPress/gutenberg/pull/22531

 

カバーブロックの背景画像で、小さい画像を繰り返し表示させてパターンとして使える機能も追加されました。

WordPress5.6 カバーブロック
【参考】Cover: Add repeated background option #26001
https://github.com/WordPress/gutenberg/pull/26001

 

カバーブロックの「カバー画像の最小の高さ」では単位を変更できるようになりました。

WordPress5.6 カバーブロック

例えば、カバーブロック幅を「全幅」にしておいて 「カバー画像の最小の高さ」の単位を「VH」にし値を「100」にすると 全画面表示になります。

 

動画ブロック

動画ブロックに字幕のサポートがつきました。

WordPress5.6 動画ブロック
ここから字幕ファイルをアップロードする形になります。

こんな感じで字幕がつきます。
WordPress5.6 動画ブロック

【参考】Add video tracks functionality #25861
https://github.com/WordPress/gutenberg/pull/25861

 

検索ブロック

検索ブロックでは 検索(submit)ボタンの有無・位置、幅設定等いろいろ変更できるようになりました。

WordPress5.6 検索ブロック

 

リストブロック:カラーコントロールを追加します

今まではインラインコードで文字色を設定できていましたが
WordPress5.6からはサイドバー側でリスト全体の文字色と背景色が設定できるようになりました。
※個別に変更できるインラインコードも併用して使えます。
WordPress5.6 リストブロック:カラーコントロール

【参考】List block: add color controls #21387
https://github.com/WordPress/gutenberg/pull/21387

 

ブロック回復の試行

なんか やってしまった時にブロックでは「ブロック回復の試行」モードになります。

WordPress5.6 ブロック回復の試行
今までは「解決」「HTMLに変換」と 3ドットアイコンから 「クラシックブロックに変換」「ブロックのリカバリを試行」を選択するようになってましたが、
WordPress5.6から「ブロックのリカバリを試行」と、3ドットアイコンから 「解決」「クラシックブロックに変換」「ブロックのリカバリを試行」になりました。

【参考】Make “Attempt Block Recovery” the default option of block invalidation #24263
https://github.com/WordPress/gutenberg/pull/24263

 

メディアと文章ブロック

メディアと文章ブロックでの画像は「フルサイズ」固定で画像が設置されていましたが
WordPress5.6から「サムネイル」「中」「大」「フルサイズ」と選択できるようになりました。
WordPress5.6 メディアと文章ブロック

 

シャープなグラデーション

グラデーションもシャープにできるようになっています。
WordPress5.6 シャープなグラデーション

どうやってやるかですが、説明がむずかしいのでこちらをお読みください。

【参考】Allow sharp gradients. #24967
https://github.com/WordPress/gutenberg/pull/24967

 

スポンサードリンク



 

コア自動更新

WordPressのコア部分では、アップデート(マイナーバージョン) があった場合は自動更新していますが、WordPress5.6から メジャーバージョンの時も自動更新できるようになりました。
WordPress5.6 コア自動更新

【参考】Introducing auto-updates interface for Core major versions in WordPress 5.6
https://make.wordpress.org/core/2020/11/02/introducing-auto-updates-interface-for-core-major-versions-in-wordpress-5-6/

【参考】WP5.6 | Auto-Update Implementation Change
https://make.wordpress.org/core/2020/11/10/wp5-6-auto-update-implementation-change/

 
 

新しいデフォルトテーマ:TwentyTwenty-One

デフォルトテーマ「TwentyTwenty-One」がでました。

Introducing Twenty Twenty-One

TwentyTwenty-Oneについてはこちらをご覧ください。

WordPress5.6 新デフォルトテーマ Twenty Twenty-One をチェックしています

また、「Twenty Twenty」「Twenty Nineteen」テーマにブロックパターンが追加されました 。

【参考】Twenty Twenty: Add Block Patterns
https://core.trac.wordpress.org/ticket/51098

【参考】Twenty Nineteen: Add Block Patterns
https://core.trac.wordpress.org/ticket/51099

 
 

jQueryバージョンの更新

WordPress5.5からjQuery関連が変わっています。
jQuery変更は影響が大きいらしいので WordPress5.5~5.7までで段階的にようす見ながら変更していくようです。

WordPress jQuery本体 jQuery Migrate jQuery UI
WordPress 5.4 ver1.12 ver1.4 ver1.11
WordPress 5.5 ver1.12 無し ver1.11
WordPress 5.6 ver3.5 ver3.3 ver1.12
WordPress 5.7(予定) 最新 無し 最新

WordPress5.6では jQuer本体がver3.5にアップグレードされます。
これにより、Lightbox2系のプラグインは動かなくなっています。

【参考】Updating jQuery version shipped with WordPress
https://make.wordpress.org/core/2020/06/29/updating-jquery-version-shipped-with-wordpress/

【2020/01/27追記】
WP jQuery Lightbox バージョン1.4.8.3 でWordPress5.6に対応されましたので利用できるようになりました。
WP jQuery Lightbox

 

WordPress5.6で 一時的に以前のjQueryのバージョンを使いたい場合は以下のプラグインで以前のjQueryに戻す事ができます。

Enable jQuery Migrate Helper


※ver1.2.0以降のを使ってください。
※管理画面 ツール → jQuery Migrate で「レガシー1.12.4-wp」を選択してください。

 

スポンサードリンク



 

開発者向け

WordPress5.6ではいろいろな機能やアクションフィルターが追加されています。
そのなかで ぉ! と思ったのを紹介します。

RESTAPI認証用のアプリケーションパスワード

WordPress 5.6にアプリケーションパスワードが導入されました。
外部から書き換え系(モバイルアプリとか)では便利になるみたいです。

【参考】Application Passwords: Integration Guide
https://make.wordpress.org/core/2020/11/05/application-passwords-integration-guide/

【参考】Proposal: REST API Authentication / Application Passwords
https://make.wordpress.org/core/2020/09/23/proposal-rest-api-authentication-application-passwords/

 

HTTP_AUTHORIZATION

CGI または FastCGI モードで動作しているサーバの中には、ベーシック認証をパスしない場合がありましたが WordPress5.6からは対応するようになりました。
そのため .htaccess の RewriteRule に「HTTP_AUTHORIZATION」が追記されるようになっています。

 

PHP8のサポート

WordPress5.6よりPHP8がサポートされました。
PHPの最低限必要要件(PHP5.6)はそのまま変更しないようです。

Call for testing: PHP 8.0

WordPressのバージョン別の PHPの互換性 はこちら。

PHP Compatibility and WordPress Versions

 

ブロックベースのウィジェット/ナビゲーション設定画面

WordPress5.6 実装予定だった「ブロックベースのウィジェット設定画面」「ナビゲーション設定画面」は 次のバージョン(WordPress5.7) になったみたいです。

Widgets Screen Not Shipping in 5.6

Navigation Screen Removed from 5.6 Release Features
https://make.wordpress.org/core/2020/10/01/navigation-screen-removed-from-5-6-release-features/

【参考】ウィジェット画面 ブロックベースのウィジェット画面
https://make.wordpress.org/core/2020/09/30/call-for-testing-the-widgets-screen-in-gutenberg-9-1/

 

wp_get_attachment_image

wp_get_attachment_image関数にフィルターが追加されました。

ソース wp-includes/media.php

	/**
	 * HTML img element representing an image attachment.
	 *
	 * @since 5.6.0
	 *
	 * @param string       $html          HTML img element or empty string on failure.
	 * @param int          $attachment_id Image attachment ID.
	 * @param string|int[] $size          Requested image size. Can be any registered image size name, or
	 *                                    an array of width and height values in pixels (in that order).
	 * @param bool         $icon          Whether the image should be treated as an icon.
	 * @param array        $attr          Array of attribute values for the image markup, keyed by attribute name.
	 *                                    See wp_get_attachment_image().
	 */
	return apply_filters( 'wp_get_attachment_image', $html, $attachment_id, $size, $icon, $attr );

 

register_sidebar

register_sidebar に サイドバーの前後にHTMLコンテンツを追加できる項目「before_sidebar」「after_sidebar」が追加されました。

	$defaults = array(
		/* translators: %d: Sidebar number. */
		'name'           => sprintf( __( 'Sidebar %d' ), $i ),
		'id'             => "sidebar-$i",
		'description'    => '',
		'class'          => '',
		'before_widget'  => '<li id="%1$s" class="widget %2$s">',
		'after_widget'   => "</li>\n",
		'before_title'   => '<h2 class="widgettitle">',
		'after_title'    => "</h2>\n",
		'before_sidebar' => '',
		'after_sidebar'  => '',
	);

 

quick_edit_dropdown_authors_args

投稿記事等のクイック編集画面で 投稿者ドロップダウンで選択する authorsリスト を簡単にフィルタリングできるようになりました。

【サンプル】authorsリストを「編集者(editor)」と「管理者(administrator)」だけにする。

/**
 * Filters the arguments used to generate the Quick Edit authors drop-down.
 *
 * @since 5.6.0
 *
 * @see wp_dropdown_users()
 * @param array $users_opt An array of arguments passed to wp_dropdown_users().
 * @param bool  $bulk      A flag to denote if it's a bulk action.
 */
function nendebcom_quick_edit_dropdown_authors_args( $users_opt, $bulk ) {

        $users_opt['role__in']                = [ 'editor', 'administrator' ];
        $users_opt['who']                     = '';
        $users_opt['hide_if_only_one_author'] = false;

        return $users_opt;
}
add_filter( 'quick_edit_dropdown_authors_args', 'nendebcom_quick_edit_dropdown_authors_args', 10, 2 ); 

【参考】Allow developers to filter the authors list on quick edit dropdown
https://core.trac.wordpress.org/ticket/47685

 

wp_after_insert_post

新しいアクション「wp_after_insert_post」WordPress5.6に追加されました。
投稿等の新規・更新の時の「save_post」の後に「wp_after_insert_post」が走ります。
REST API や カスタマイザー でも走りますので 便利になりそうです。

ソース wp-includes/post.php

	/**
	 * Fires once a post, its terms and meta data has been saved.
	 *
	 * @since 5.6.0
	 *
	 * @param int     $post_id Post ID.
	 * @param WP_Post $post    Post object.
	 * @param bool    $update  Whether this is an existing post being updated.
	 */
	do_action( 'wp_after_insert_post', $post_id, $post, $update );

【参考】New action wp_after_insert_post in WordPress 5.6.
https://make.wordpress.org/core/2020/11/20/new-action-wp_after_insert_post-in-wordpress-5-6/

 
 

フルサイト編集(FSE)

WordPress5.6 よりフルサイト編集(FSE)機能が実装される予定でしたが、どうやらWordPress5.7からになるようです。
新しいデフォルトテーマ「Twenty Twenty-One」も フルサイト編集(FSE)には対応していません。

「Twenty Twenty-One」では 「Twenty Twenty-One Blocks」として 別のテーマでこれから作るようです。

Developing the Full Site Editing version of Twenty Twenty-One

 

フルサイト編集(FSE)てどんなの? て興味がある方は FSE専用の「Qテーマ」というのがありますので試してみてはいかがでしょうか。
Gutenbergプラグインをインストールしたら使えるようになります。

【参考】Q: First FSE WordPress Theme Now Live
https://wptavern.com/q-first-fse-wordpress-theme-now-live

 
 

WP Multibyte Patch

毎回 言いますが WordPress5.0から 必須のプラグインで 日本語版パッケージに 付属してた「WP Multibyte Patchプラグイン」は含まれなくなっています。
だいたい いけるようにはなってますが 日本語で使う場合は やっばり必ず 最新版をインストール → 有効化 してくださいね。

【参考】「WordPress 5.0 利用開始前に知っておくべきこと」
https://ja.wordpress.org/2018/11/04/things-to-know-before-using-wordpress-5-0/

WP Multibyte Patch プラグイン
https://ja.wordpress.org/plugins/wp-multibyte-patch/

WP Multibyte Patch – EastCoder;
https://eastcoder.com/code/wp-multibyte-patch/

本家版、日本語版 WordPress のマルチバイト文字の取り扱いに関する不具合の累積的修正と強化を行うプラグインです。英語圏で作られた WordPress を日本語環境で正しく動作させるために必要となる機能を網羅していますので、なんらかの対策を行っていない場合は導入をおすすめします。

 
 

バックアップとってね

メジャーアップデートでは必ずバックアップをとるようにしましょう。ファイルとデータベースのバックアップは必ずとるようにしてください。
今回のはjQueryが変わったり、ブロック部分がだいぶん変わってますのでプラグインやテーマ、CSSとかチェックしといた方がいいですね。

【参考】
WordPress のバックアップ – WordPress Codex 日本語版
http://wpdocs.osdn.jp/WordPress_%E3%81%AE%E3%83%90%E3%83%83%E3%82%AF%E3%82%A2%E3%83%83%E3%83%97

BackWPup – WordPress Backup Plugin
https://wordpress.org/plugins/backwpup/

できれば 本番のバックアップから テスト環境 を作って動作テストをする事をお勧めします。