• Hello everyone.

    I am trying to make this simple plugin to just run when is a comment from the attachment file, but for some reason when I put the code in a if is_attachment() it doesn’t work…

    When I comment out the if statement it works.

    Any ideas? thanks!


    function notify($comment_id) {

    if(is_attachment()) {
    $user_email = '[email protected]';

    $subject = $comment_id . get_option('blogname');

    $t1 = 'Someone commented on a your picture';

    $t2 = "click here to see the comment";

    wp_mail( $user_email, $subject, $text );

    }
    }
    add_action('comment_post', 'notify');

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter mhhenn

    (@mhhenn)

    More info:

    If I the add_action inside the function and then call the function in the attachment file, it works but doesn’t get the $comment_ID, what is really important…

    
    function notify($comment_id) {
    
    $user_email = '[email protected]';
    
    $subject = $comment_id . get_option('blogname');
    
    $t1 = 'Someone commented on a your picture';
    
    $t2 = "click here to see the comment";
    
    text = $t1 . $t2;
    
    wp_mail( $user_email, $subject, $text );
    
    add_action('comment_post', 'notify');
    
    }
    
    Ideas?
    
    Thread Starter mhhenn

    (@mhhenn)

    Help please!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Send email on attachment page’ is closed to new replies.