Written by Anonymous
<?php //子テーマ用関数
if ( !defined( 'ABSPATH' ) ) exit;
//子テーマ用のビジュアルエディタースタイルを適用
add_editor_style();
//以下に子テーマ用の関数を書く
//add_filter( 'author_rewrite_rules', '__return_empty_array' );
// 投稿者アーカイブページへのアクセスを恒久的にプロフィールページにリダイレクトする
add_action( 'template_redirect', function() {
if ( is_author() ) {
wp_safe_redirect( get_permalink( 84 ), 301 );
exit;
}
});
////一部機能・プラグインを除外しREST APIを無効
function deny_restapi_except_plugins( $result, $wp_rest_server, $request ){
$namespaces = $request->get_route();
//oembedの除外
if( strpos( $namespaces, 'oembed/' ) === 1 ){
return $result;
}
//Jetpackの除外
if( strpos( $namespaces, 'jetpack/' ) === 1 ){
return $result;
}
//Contact Form7の除外
if( strpos( $namespaces, 'contact-form-7/' ) === 1 ){
return $result;
}
return new WP_Error( 'rest_disabled', __( 'The REST API on this site has been disabled.' ), array( 'status' => rest_authorization_required_code() ) );
}
add_filter( 'rest_pre_dispatch', 'deny_restapi_except_plugins', 10, 3 );