フック(add_action()関数)

複数の処理を順に実行し続けるための接着剤のような役割を果たしている機能。

add_action( アクション名, 実行したい関数名, 作業順序 )
  • add_action():フックを登録する関数の1つ。function.phpに記述して、WordPressの一連の作業に割りこませる
/* テーマの準備が整った後(after_setup_theme)のタイミングで関数「neko_block_setup」を実行する */
function neko_block_setup() {
  (略)
}
add_action( 'after_setup_theme', 'neko_block_setup' );
inserted by FC2 system