Warning: Undefined array key 2 in /home/xs390735/increment-log.com/public_html/wp-content/themes/increment-log/functions.php on line 349
Warning: Undefined array key 4 in /home/xs390735/increment-log.com/public_html/wp-content/themes/increment-log/functions.php on line 354
Warning: Undefined array key 6 in /home/xs390735/increment-log.com/public_html/wp-content/themes/increment-log/functions.php on line 359
タイトルの通り、シンタックスハイライターの『Crayon Syntax Highlighter』をREST APIで無効にする方法についです。
REST APIで無効にするスニペット
以下コードをfunctions.phpに貼り付けてご使用ください。
// REST APIでCrayon Syntax Highlighterを無効化
function il_pre_register_routes() {
remove_filter( 'the_posts', 'CrayonWP::the_posts', 100 );
}
add_action( 'wp_json_server_before_serve', 'il_pre_register_routes' );とても限定的ですが、Nuxt.jsでWordPressテーマを作成しているときに既存サイトから情報を取得する必要があったので、こちらのコードで対応しました。
