Cem Baykam
Cem Baykam

Reputation: 537

Wordpress Coding a custom action hook

I am trying to develop a custom wordpress plugin to manage my membership types. To handle payments I want to have 2 custom action hooks one for payment success and one for payment failure. And if possible I want these hooks to work in all the themes.

Could not come up with a proper solution. Does anybody knows where to place the templates for membership types.

Upvotes: 0

Views: 608

Answers (1)

Sjors
Sjors

Reputation: 1215

You can use the following code to execute your own action hook:

do_action( 'payment_success' )

Then you can 'hook onto' this hook with:

add_action( 'payment_success', 'your_function' )

Since the theme's functions.php file is loaded after all the plugins are loaded, your hook will be available in all themes.

Upvotes: 2

Related Questions