/** ページ投稿タイプのみ違ったエディタースタイルを入れる * Registers an editor stylesheet for the current theme. * * @global WP_Post $post Global post object. */ function wpdocs_theme_add_editor_styles() { global $post; $my_post_type = 'page'; // 新規投稿 (initフック). if ( stristr( $_SERVER['REQUEST_URI'], 'post-new.php' ) !== false && ( isset( $_GET['post_type'] ) === true && $my_post_type == $_GET['post_type'] ) ) { //ここから add_editor_style('../../../css/item.css'); add_editor_style('../../../css/d_master.css'); add_editor_style('../../../css/d_temp1.css'); add_editor_style('../../../css/big_sapce.css'); //ここまで } // 投稿の編集 (pre_get_postsフック). if ( stristr( $_SERVER['REQUEST_URI'], 'post.php' ) !== false && is_object( $post ) && $my_post_type == get_post_type( $post->ID ) ) { //ここから add_editor_style('../../../css/item.css'); add_editor_style('../../../css/d_master.css'); add_editor_style('../../../css/d_temp1.css'); add_editor_style('../../../css/big_sapce.css'); //ここまで } } add_action( 'init', 'wpdocs_theme_add_editor_styles' ); add_action( 'pre_get_posts', 'wpdocs_theme_add_editor_styles' );