EDIT – SOLUTION
I got the solution using status ‘new_to_pending’ and adding the $auto object.
function newpost_notify( $auto ) {
$mailadmin = '[email protected]';
$subject="Subject";
$headers="MIME-Version: 1.0" . "\r\n";
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
$headers .= 'From: xxx <[email protected]>' . "\r\n";
$message="There\"s a new post.';
wp_mail( $mailadmin, $subject, $message, $headers );
}
add_action( 'new_to_pending', 'newpost_notify', 10, 2 );
thanks to the constructive comments of @Rarst & @flomei
Related Posts:
- Restrict custom post type to only site administrator role
- Prevent pre_get_posts filter on specific post type
- How to force one column layout on custom post type edit page?
- Multiple post types – share same ReWrite slug?
- How to change “Draft” string for status of custom post type to “Unavailable”?
- Search multiple custom fields by using meta_query
- How to Remove Certain Screen Options and Table Columns from post type in wp_list_table?
- How does one delete orphan custom post type?
- Redirect after deleting post and keep track of pagination
- Add comments meta fields to comments metabox on post edit screen
- Custom Post Type with Custom Title
- remove_action conditionally for Custom Post Type
- How can I customize “Pages” admin (edit.php) and “Edit Page” admin (post.php) for bulk edit of custom content type?
- Assigning a role to a specific custom post type (and ignoring other post types)
- Display posts in random post types
- Custom Post Type by user
- Interesting Custom Post Type Slug with Taxonomy and Custom Field
- same archive template for different custom post
- Comment Email Notification for CPT Comments
- How do I add a custom button to my “edit” list? ( edit.php?post_type= ) beside “Add New”
- Show admin help message across custom post type parent and child posts
- How do you output custom code between posts in the loop?
- How to add notification in the sidebar of the administration panel when a Custom post type is created? [duplicate]
- How to use wp_mail in CPT page
- Best practice for adding posts in bulk
- WP 3.1 getting tax_query to work in query_posts()
- How to get Custom Post ID by adding filter to child theme’s function
- Impossible to get Attachments Outside WordPress?
- Remove All, Published and Trashed Post Views in Custom Post Type
- WordPress if in term*
- Weird problem happening with custom taxonmy when creating/updating posts
- How to structure a site with product variations pages?
- CPT: if more than X images are in post, use pagination
- Ajax Check Post Status
- Conditional Query of Custom Post Type and custom taxonomy
- Meta query for custom post type ignored in main query
- How do I move/order posts with a tag to the end?
- Use same slug base for Custom Post Type posts, and multiple taxonomy terms
- Custom Path/Folder behind a custom post type
- Structure of data : CPT + terms
- Default text in a specific post type, but not visible?
- Send notifications to custom post author when custom post is edited
- WP_Query custom post type query not showing the exact post type
- How to remove post listing page for a custom post type
- How to include term custom meta into the custom taxonomy term permalink structure
- How can the recipients and content for comment email notifications on a custom post type be changed?
- How do i search authors from search form using author’s name
- How to produce a sub-page-system in WordPress
- How do you make a custom post type items automatically delete items 3 months after publication?
- custom post data – how to
- How to display custom field value on page?
- Add an Outside Wrapper to my Header and Make it Full Width
- WordPress custom API endpoint – how to make the request more flexible
- Create custom WP_List_Table in post_type
- How to hide a custom field from admin?
- Get terms for a specfic post from multiple taxonomies in custom post type
- CMB select with data from CPT
- cannot achieve this structure (custom posts VS categories VS ??)
- Is it possible to have hierarchical taxonomy and hierarchical custom post types in one permalink?
- how to use custom post types collectively integrated with each other
- Why doesnt my tag page populate with this custom post type?
- Home page is getting current-menu-item even if it’s not home
- Problem with customize page cached in WordPress.com [closed]
- Multiple categories assigned to a single product breaking the breadcrumb
- Adding a location field to buddypress activity
- Create API’s for custom-post types & custom queries using REST or Graphql
- custom post type and user post count shortcode
- How can I assign multiple parents to CPT?
- Getting 404 on child page with pre_get_posts() on custom posts
- CPT: multiple loops with different terms
- Limit posts per page depending on the size of a div?
- Delete Post by User
- save_post affect creation and deletion
- Set a static page as a user profile page?
- Problem to get the link of the default ‘post’ post type like the orther custom types
- how to display notifications in the wordpress menu when a new post is published
- WordPress query posts by custom post type not workng
- How to display all custom fields associated with a post type – IN THE ADMIN AREA?
- How to keep a CPT stick to specific position?
- Static front page has page url not site url
- WP_Query for CPT with filter by another WP_Query
- Using get_terms() as shortcode attribute
- Turn post into simple slideshow
- Problems with a custom meta_box
- Multiple Block Quotes without using HTML
- How to apply order on custom taxonomy and custom meta key on custom post type
- How can i display on front page a movie that is atached in a post type
- Data won’t save on a straightforward metabox, what am I missing?
- Custom post type functions.php if statement on action
- Query multiple post of which one by taxonomy
- How to make a template for a specific post of a custom post type?
- Bulk update custom post types
- Set a Custom Post Type as a Homepage
- Slideshow/Gallery plugin based on WP Core Gallery [closed]
- How to create a job post by email parsing? [closed]
- ACF select box css color change
- Creating post custom field text area
- Same slug for Custom Taxonomy archive and CPT archive – Rewrite rule not working
- is therer any wordpress function to retrieve a specific html element from post content
- How to display *block number* instead *date value* on WordPress posts?