• Hi!

    When updating a custom post type (“performance”) using the GF updater plugin, a function I wrote to notify the admin when a published performance is changed does not fire. It does fire when editing the performance directly in the backend.

    Here’s the function:

    //send admin email when a published performance is changed by user
    function bits_performance_update_notification( $new_status, $old_status, $post ) {
        if ( $old_status == 'publish'  &&  $new_status == 'publish' && get_post_type($post) == 'performance' ) {
    		$post_url = get_permalink( $post->ID );
    		$subject = 'A published performance has been changed';
    		$message = "The following performance was changed:\n\n";
    		$message .= $post->post_title;
    		$message .= $post_url;
    		$email = [email protected] ;
    		//sends email
    		wp_mail($email, $subject, $message );
    		}
    }
    add_action( 'transition_post_status', 'bits_performance_update_notification', 10, 3 );

    Any assistance would be appreciated. Thank you!

    https://ww.wp.xz.cn/plugins/gravity-forms-post-updates/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jupitercow

    (@jcow)

    When you edit in the backend, are you changing the status of the post?

    eg: from draft to publish?

    And when you edit in Gravity Forms using this plugin, are you also changing the status of the post?

    Thread Starter bcupham

    (@bcupham)

    Hi,

    Thanks for getting back. No, the post is status published before and after the edit, whether I am doing it in the backend, or the user is doing it via the plugin.

    Thanks,
    Ben

    Plugin Author Jupitercow

    (@jcow)

    I am not sure what might be happening. That action should trigger when the status changes.

    I am curious as to why it is fired in the backend, but not the front end. I will look a bit deeper at how it gets fired.

    Thread Starter bcupham

    (@bcupham)

    Thanks. If you can’t replicate it, let me know….

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘WP Post status action hooks not triggering’ is closed to new replies.