What is the difference between following two codes? (Directly call a function and call a function using add_action)
function pp_submit__link_form(){
if(isset( $_POST['action']) && $_POST['action']="submit_link" ){
echo "Hello";
}
}
add_action( 'init', 'pp_submit__link_form' );
function pp_submit__link_form(){
if(isset( $_POST['pp_action']) && $_POST['pp_action']="submit_link" ){
echo "Hello";
}
}
pp_submit__link_form();
add_action
doesn't call the function. it hooks the fonction to the hookinit
in a first time. and in a second time the function is called when theinit
is fired. look this to know wheninit
is called : wordpress.stackexchange.com/questions/71406/…