Last active
February 6, 2016 11:06
-
-
Save miya0001/5c76f0d1a29c815237b4 to your computer and use it in GitHub Desktop.
一回だけだよっ!ていうサンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'shutdown', 'my_shutdown_callback' ); | |
function my_shutdown_callback() { | |
do_action( 'custom_shutdown_hook' ); | |
} | |
add_action( 'save_post', 'my_save_post_callback' ); | |
function my_save_post_callback() { | |
add_action( 'custom_shutdown_hook', 'something' ); // save_postが複数回発火してもsomething()は一度しか発火しない | |
} | |
function something() { | |
// メールを送るとか | |
} | |
do_action( 'init' );
を連打すると$nが増えるので注意
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
例えば