您可以使用publish_post
用于通知帖子作者的操作挂钩。
function wpcs_author_notification( $post_id ) {
$post = get_post( $post_id );
$author = get_userdata( $post->post_author );
$message = "Hi " . $author->display_name . ", Your post, " . $post->post_title . " has just been published at " . get_permalink( $post_id );
wp_mail( $author->user_email, "Your article is published", $message );
}
add_action( \'publish_post\', \'wpcs_author_notification\' );
此函数将通知作者发布的帖子。您可以在上述代码中修改消息。