Support » Themes and Templates » What can add_action hook too?

  • When using add_action, you have to insert a hook name. Can this name be any PHP function that’s defined and called or what are the guidelines?

    The documentation says: hook_name is the name of an action hook provided by WordPress, that tells what event your function should be associated with.

    If I can’t use any php function name I created, how can I add the name to think action hook name list or what not?

Viewing 1 replies (of 1 total)
  • They come in pairs. The add_action function takes a hook name and a function name to call. But it’s actually run when there is a do_action call, which specifies the hook name.

    So, this code:

    add_action('blah','do_something');
    do_action('blah');

    would cause the do_something function to run.

    So look for the corresponding do_action to figure out where your hook is called from.

    Filters work the same way, with add_filter and apply_filter.

Viewing 1 replies (of 1 total)
  • The topic ‘What can add_action hook too?’ is closed to new replies.