Add link for CPT to another CPT on submit button

class oArenaAddTeam { public function __construct() { add_action (‘init’, [$this, ‘addTeamTournament’]); } function addTeamTournament() { // add_action(‘add_meta_boxes’, ‘addTeamTournament’); // $post = get_post_type(); // echo ‘you are here’; $author_id = get_current_user_id(); $args = array( ‘author’ => $author_id, ‘post_type’ => ‘team’, ‘order’ => -1 ); $user = get_posts($args); // untill there i have the var dump ok … Read more

Send mail to author when custom post type is saved

Try this way: function send_emails_on_new_event( $post ) { $emails=”[email protected]”; $headers=”From: Name <[email protected]>”; $title = wp_strip_all_tags( get_the_title( $post->ID ) ); $message=”New post created”; if ( get_post_type( $post->ID ) === ‘documents’ ) { wp_mail( $emails, ‘New Post’, $message, $headers ); } } add_action( ‘pre_post_update’, ‘send_emails_on_new_event’ ); From the Code Reference: pre_post_update: Fires immediately before an existing post … Read more