• Hi,
    I’m using the free version of WP Webhooks, but struggling to understand the docs. I want to fire a webhook when a new Custom Post Type is added. Do I use the trigger “Send Data On New Post” and if so – how to I choose the CPT I want? Or do I chose the trigger “Send Data On Custom Action”?
    I have the url of the webhook, but I just don’t know how or where to fire the trigger. It says “You can fire the trigger wherever you want within your PHP code.” Does that mean I add some code to my functions.php file? And if so, what code do I add? Does it need to be inside a function or do I simply add it to my functions.php file.
    Sorry for my basic understanding.
    Thanks for your help
    Ian

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Ironikus

    (@ironikus)

    Hey @iananderson – Thank you very much for reaching out, as well as for using our plugin.
    Just to clarify one thing: Do you really want to fire a trigger once a new post type is added, or only once a new post for a custom post type is added?
    Depending on that, I can give you further advice on that.

    In general, the “Send Data On Custom Action” code example can be included anywhere. It’s just a question of when you want to fire it. If you include it directly into your functions.php file, it will cause the trigger to fire with every call of your WordPress site, regardless of backend or frontend.

    To only fire it on certain events, I suggest finding an adequate hook that links to your action you want to fire the trigger on. Within the callback, you can then add the code.

    If you have any further questions in the meantime, feel free to let me know. ??

    Thread Starter iananderson

    (@iananderson)

    Thanks for your reply.

    I would like to fire the webhook when a new post is added for a custom post type.

    Sorry for my lack of knowledge. Does the hook need to be specific to the custom post type? How would I know what the hook is?

    Thanks again,

    Ian

    Plugin Contributor Ironikus

    (@ironikus)

    Hey @iananderson – Thank you very much for your answer and the additional details.
    You know what hook it is based on where you want to send the data to.
    If you want to send the data, e.g. to Integromat or Pabbly, you will receive there within their app a webhook URL that can receive data.
    This URL is what you then add within the “Send Data” tab of our plugin to the “Send Data on New Post” webhook.

    Once it’s there, you will find a little settings link next to the added URL – there you have further features on controlling what data you really want to send over.
    Feel free to take a look at it via the web view of our plugin here: https://wp-webhooks.com/free/send-data/?&wpwh-trigger=post_create#webhook-4

    Do let me know in case you have any further questions. ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘New Custom Post Type Trigger’ is closed to new replies.