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?
- Merge two custom post types into one admin page?
- Remove the “View” Link in Post Admin
- Add “Last Edited by” column to custom post type list table
- 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
- Prevent reload confirmation after AJAX save
- jQuery UI in Admin (Best Practice?)
- Admin Post Update Redirection to Posts Screen
- Exclude add_filter from the admin
- Custom Post type sort order not working in the admin area
- Custom admin columns for ALL custom post types
- 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
- Custom Post Type and taxonomies’s labels localization not working
- 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?
- 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]
- Custom post admin filtering by post meta (the date)
- Admin Column Text Positioning
- Add text to wordpress admin ‘Add Post’ edit
- 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
- Set a default category – if the user didn’t select one- before creating a post
- Add html to cpt main page / admin edit.php
- Is there a way to have the view link on manage posts page to open in a new window or tab?
- 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
- Custom Post Type Nav to Subpage
- Selecting a post in Dashboard
- A simple script to allow sorting of custom posts in admin?
- 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.”
- 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
- How to check if post/page or taxonomy post is published by admin
- CPT Columns doesn’t show categories
- Insert Custom Post Types
- sortable columns for multiple custom post types not working
- Custom Post Type – Support “author” only for admins
- Showing User’s Post Counts by Custom Post Type in the Author.php?
- Add ‘page template’ column to dashboard for CPTs
- Filter posts of custom post type by meta key in (List All Section)
- get_post_types not working properly in admin
- Require custom post type if is_admin() – template doesn’t show up?
- Function to add custom HTML into head in custom post-type list page
- Multiple custom post types on same admin page
- using the loop in custom meta is messing up ‘add new’ post type
- Metaboxes inside Tab
- How can I put content before my custom post type default pages?
- How we can create menu from Appearance > Menu and use as a add-submenu-page for admin menu?
- How to display an admin-notice after custom post type edit modification
- Is there any filter to add a custom attribute to the tag in admin panel?
- How to hide private posts even if user is admin
- Adding orderby url parameter to main CPT admin menu link
- Help Adding filter to Add Media button for custom post type
- Delete all custom posts then upload a new CSV of events
- Pagination in wp-admin for CPT
- how to display notifications in the wordpress menu when a new post is published
- Custom post type doesn’t display on admin list
- BCC email to subscribers
- Shared Custom post type between WP network sites
- Admin menu post type
- WordPress Author Posts Review After Every Change In The Same WordPress Post
- Redirect preview single post link to a page
- Custom Post Type Causing Admin Sidebar UI Issue
- How to change the default orderby from “Date” to e.g. “Title” or my custom column in content type records list in admin?
- Change column of row action (Quick Edit) links in WP_List_Table
- Prevent users from changing post status
- Custom Plugin w/ Custom Post Types – Custom Posts Are Showing at all Privilege Levels – Is this possible to adjust?
- Admin menu link with variable