add_action question (4 posts)

  1. elmo
    Posted 10 years ago #

    I am trying to trigger a plugin using:

    add_action('edit_post', 'my_function') and
    add_action('publish_post', 'my_function')

    But nothing happens. If I switch to:

    add_action('wp_head', 'my_function')

    The plugin executes when loading my index page just like it should. But I dont want to call the plugin every time the page is loaded just when edit or publish is called. Is this a common problem, I just can't make it work?

  2. zeeg
    Posted 10 years ago #

    What exactly does your function do?

  3. elmo
    Posted 10 years ago #

    It fetches values from the custom fields.
    Then it makes a call to the Google API using the values from the custom field as searchwords.
    The result is saved in a database.

    As mentioned before this works when calling wp_head (or shutdown) but not for edit_post or publish_post.

  4. skippy
    Posted 9 years ago #

    What diagnostic steps have you taken? For example, have you made the first step of your function die('hiya!'); to confirm whether your plugin is even being triggered?

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.