Site icon Hip-Hop Website Design and Development

Ship notification to the admin when new customized put up is submitted

I’ve a cpt known as “auto” and that i make a frontend kind to create new put up with “pending” standing.
After the put up submission i’d obtain an electronic mail with a notification of the brand new put up.

operate newpost_notify() {

  $mailadmin = 'xxx@area.com';
  $topic = 'Topic';
  $headers  = 'MIME-Model: 1.0' . "rn";
  $headers .= 'Content material-type: textual content/html; charset=UTF-8' . "rn";    
  $headers .= 'From: xxx <noreply@area.com>' . "rn";
  $message = 'There is a new put up.';

  wp_mail( $mailadmin, $topic, $message, $headers );
}

add_action( 'publish_post', 'newpost_notify', 10, 2 );

That is my code..however i did not obtain any electronic mail.

I might know if there is a distinction between a “new put up” and a “publish put up”, as a result of i learn one thing concerning the put up standing transition.

Thanks