As far as I understand about the action hook, add_action
is used to add callback functions to an exsiting action hook, which means, to make lines like
add_action('some_action_hook',function(){ // some function})
work, you need to have a line that says do_action some_action_hook
somewhere in your code. Is this understanding right?
I come across an action hook that I couldn't find where it is triggered: it is woocommerce's woocommerce_thankyou_bacs
. I've done a thorough text search inside my website root folder for woocommerce_thankyou_bacs
, the only line coming up is
add_action( 'woocommerce_thankyou_bacs', array( $this, 'thankyou_page' ) );
in \wp-content\plugins\woocommerce\includes\gateways\bacs\class-wc-gateway-bacs.php
.
I've also done a regex search for thankyou.*bacs
, the result is same. I also search this action hook online and in Woocommerce's documentation, but didn't get much useful informations.
This itself is trivial, but I'd like to know:
- Is the understanding that where there is a
do_action
, there must be a correspondingadd_action
correct, or at least generally correct? - If 1) is correct, what is the solid way to find where
do_action
is for a certain action hook?
add_action( 'qjfberbierb fi', ...
is still perfectly valid even though I mashed my keyboard to get the action name and it will never be ran.