Forums

Send email when publish custom post - Action (2 posts)

  1. Omegakenshin
    Member
    Posted 1 year ago #

    Hi, I want to know the action for when you click on the Publish button,

    I got a custom post type for client's orders, so when I add an order, I want to send an email to my Client email with the data.

    Hope you can help me, I really apreciate your time.
    Thanks

    Edit: I think the answer is

    <?php
    add_action('publish_post', 'my_custom_function');
    ?>

    but how can I tell it, to send the email just when is the custom post "orders".

  2. ucfknight10
    Member
    Posted 1 year ago #

    in the definition of my_custom_function, you'll want to grab the variable $post or $id, using global $id,$post;. from there, you can determine the post type

Topic Closed

This topic has been closed to new replies.

About this Topic