<?php //子テーマ用関数

//子テーマ用のビジュアルエディタースタイルを適用
add_editor_style();

//以下に子テーマ用の関数を書く

//セキュリティー対策　rest_route
// 2024.05.11 add

add_action( 'init', 'ignore_rest_route_parameter' );
function ignore_rest_route_parameter() {
     if( isset( $_GET['rest_route'] ) ) {
         $_GET['rest_route'] = null;
     }
}
//セキュリティー対策 /?author=1 でユーザー名を非表示
//  2025.2.20
function disable_author_archive_query() {
 if( preg_match('/author=([0-9]*)/i', $_SERVER['QUERY_STRING']) ){
  wp_redirect( home_url() );
  exit;
 }
}
add_action('init', 'disable_author_archive_query');