0

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.

Cem Baykam
  • 507
  • 1
  • 7
  • 20

1 Answers1

2

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.

Sjors
  • 1,205
  • 1
  • 8
  • 24
  • Thanks for the answer, But can I handle that theme in the plugin folder too? I want all the stuff to be in the plugin only to be able to install to multiple sites. – Cem Baykam Jan 28 '15 at 12:28
  • No you need to modify the plugin so it uses your plugin, or hook it to default WordPress action hooks. – Sjors Jan 28 '15 at 12:30