You’ll need to check the $pagenow
variable and the post type of the post being edited. It will look something like this:
function wpse_75224_admin_notices() {
global $pagenow;
$is_edit_custom_post_type = ( 'post.php ' == $pagenow && 'my_custom_post_type' == get_post_type( $_GET['post'] ) );
$is_new_custom_post_type = ( 'post-new.php' == $pagenow && 'my_custom_post_type' == $_GET['post_type'] );
$is_all_post_type = ( 'edit.php' == $pagenow && 'my_custom_post_type' == $_GET['post_type'] );
if ( $is_all_post_type || $is_edit_custom_post_type || $is_new_custom_post_type ) {
echo "Your message.";
}
}
add_action( 'admin_notices', 'wpse_75224_admin_notices' );
Related Posts:
- How to Make an admin_notices Message That Disappears Once the User Leaves That Particular Page?
- Notify admin on new submit
- Load a script just to custom post type in admin
- Placing a Custom Post Type Menu Above the Posts Menu Using menu_position?
- Loading External Scripts in Admin but ONLY for a Specific Post Type?
- Customize Edit Post screen for Custom Post Types?
- Filter by custom field in custom post type on admin page
- Showing User’s Post Counts by Custom Post Type in the Admin’s User List?
- Merge two custom post types into one admin page?
- Remove the “View” Link in Post Admin
- Multiple custom post types under one admin menu
- How can I change the admin search posts fields?
- Custom post type: Add “Edit | Quick Edit | Trash | View” links to date (if title is not shown in column)?
- Admin Area Custom Type Search By Meta Fields Without Title & Content
- Add “Last Edited by” column to custom post type list table
- How can I filter posts by post_parent in the admin?
- Filter custom post types in admin not working
- Custom post type admin search
- Ordering posts by custom taxonomy in admin area
- Create a dropdown with Custom Post Types as option in admin
- How to add custom columns to Custom Post Type admin screen
- Filter admin columns by custom post field value
- Is it OK to move admin menu items?
- Prevent reload confirmation after AJAX save
- Filter by custom Field for Custom post type Admin Listing
- jQuery UI in Admin (Best Practice?)
- Admin Post Update Redirection to Posts Screen
- Exclude add_filter from the admin
- Renaming Menu Item within Admin Menu Section for a Custom Post Type?
- Custom Post type sort order not working in the admin area
- Admin to user notices – best practices?
- Custom admin columns for ALL custom post types
- How to get search results in the backend admin on a custom post type?
- Add custom column to custom post type overview in backend
- Unable to filter on field on edit.php page
- How to Change the Title of a Meta Box on a Specified Custom Post Type? [duplicate]
- No results searching custom post type in admin panel
- How to add post_author column to custom post type
- Adding help information to custom post edit page
- Only Show an Author Their Custom Post Types
- Actions that Run on Admin Edit Page Load After Posts Are Queried
- Custom Post Type and taxonomies’s labels localization not working
- Change admin post thumbnail size for custom post type only
- Filters post in admin with dropdown select, custom post type
- Admin List Dynamic Heading
- How can I add a column in the wp_list_table of the admin area?
- How to show custom (checkbox) field value in admin post list?
- WordPress User Roles, Custom Post Types, and Admin views
- Settings page above CPT page in admin section
- How to add notification in the sidebar of the administration panel when a Custom post type is created? [duplicate]
- How to search CPT’s by meta query from the admin dashboard?
- Add theme options to custom post type admin pages [closed]
- Using WPAlchemy metabox values in another metabox
- Custom post admin filtering by post meta (the date)
- Admin Column Text Positioning
- Add text to wordpress admin ‘Add Post’ edit
- Changing ‘view’ link for custom post type on list post screen?
- Sort admin area by custom Event Date field
- How can I change the title of an Add New page in Admin for custom post type
- How to customize admin posts based on the user who is logged in
- Set a default category – if the user didn’t select one- before creating a post
- Add html to cpt main page / admin edit.php
- How can I create a custom meta box to add an mp4 video to a page?
- Remove rows in the manage post/page view
- Is there a way to have the view link on manage posts page to open in a new window or tab?
- Access $post object when adding custom columns to list table
- How to only show posts assigned to current user, only in certain post types
- Ajax Check Post Status
- Add acf field in title (admin table)
- Adding HTML tags or css classes to admin columns
- Create a page that will be used to create a custom post type
- Customize my custom taxonomy table in Admin panel
- Get parse_query filter to return slug instead of id
- Custom Post Type Nav to Subpage
- Selecting a post in Dashboard
- Custom admin post.php page
- A simple script to allow sorting of custom posts in admin?
- How to add a custom-post-type post within another custom-post-type post edit screen using AJAX?
- On update or create post redirect to current post position in list
- Options page – dropdown of users
- No Permission to add new Page, Post or CPT with Admin role
- Send notifications to custom post author when custom post is edited
- Admin Column does not populate with data
- How can the recipients and content for comment email notifications on a custom post type be changed?
- Send notification to the admin when new custom post is submitted
- Filtering posts list table
- CPT Validation to not show “Post updated.”
- Edit Custom Post Type on Custom Admin Page instead Post Admin
- Custom post type isn’t working
- comment_notification_text filter for custom post type
- Add a ‘guide’ image to custom post type admin page
- Delete “Post Published. View Post” for custom post type
- Send a conditional email notification when a custom field value changes in Post Type
- Use remove_meta_box conditionally on custom post type
- New “Custom Types” item in admin menu. Is this a plugin or a new wordpress feature?
- How to group navigation items in the admin panel
- Sortable column containing numeric values for Custom Post Type at WordPress Backend
- How to check if post/page or taxonomy post is published by admin
- Linking to Post Types from wp-admin
- Plugin or method of allowing user to rearrange custom post types with drag and drop?