関連記事を出してみる。

つくった。

カスタム投稿用
タクソノミーを使った記事の出力。
自身が持つタクソノミーと同一のIDどれか1つでも持っている記事を自身を除く$post_count件をランダムで出力する。

//関連記事の取得 カスタム投稿用
function get_related_custom_posts($post_id,$post_type,$post_count){
	$taxonomies = get_object_taxonomies( $post_type, 'objects' );
	foreach($taxonomies as $taxonomy){
		$terms[$taxonomy->name] = get_the_terms($post_id,$taxonomy->name);
	}
	$tax_query['relation'] = 'OR';
	foreach($terms as $term_name => $term_array){
		//$tax_query[$term_name] = $term_array;
		foreach($term_array as $term){
			$tax_query[][] = array(
				'taxonomy' => $term_name,
				'field'    => 'term_id',
				'terms'    => $term->term_id,
			);
		}
	}
	$args['posts_per_page'] = $post_count;
	$args['post_type'] = $post_type;
	$args['tax_query'] = $tax_query;
	$args['post_status'] = 'publish';
	$args['post__not_in'] = array($post_id);
	$args['orderby'] = 'rand';
	$related_post = new WP_Query( $args );
	return $related_post->posts;
}

よく忘れるので

日付の出力方法をよく忘れるのでメモ

date('Y/m/d',strtotime($post->post_date));

WP5.0が来たか・・・。

とりあえずアップデートかけたけど
エディター周りの検証が必要かなぁ。

クラシックエディターのプラグインを稼働させて
ブロックエディターのプラグインが有効じゃないと画面が停止するっぽいな?
とおもったら2回目は動いた。
うーん、プラグインの更新が間にあったからかな。
エディターの切り替えはサイドバーじゃなくってメディアの追加の隣とかボタン群の中でも良かったのでは?