Based on your comment, you don’t actually care about the current screen. You care about the post type. They might be related but they’re not the same thing. If you want to target a specific post type in the wp_after_insert_post
hook, you can use the post object passed to the hook callback:
add_action(
'wp_after_insert_post',
function( $post_id, $post ) {
if ( 'post' === get_post_type( $post ) ) {
// Do something.
}
},
10,
2
);
Just replace 'post'
with whichever post type you want to check.
Related Posts:
- Connection lost. Saving has been disabled… (Updating Posts/Pages)
- Post/Page Publish/Update button not clickable once I make an edit
- how to limit edit_form_after_title hook to page and post edit only?
- Strategy for handling hierarchical pages with empty parent content
- How to add a new tab to page editor
- How to change post to page
- Why do I need to use The Loop on pages (inside page.php etc)?
- Create custom page in WooCommerce
- Determining Slug Before and After Edit
- Automatically create pages in a post based on number of words
- Static posts page with home.php
- Change WordPress post-state in Admin Area
- how to show all post in my page-grid.php template page
- eBooks download website, page or post?
- Can I hide a specific post from latest posts page?
- Hide add new page button
- How to show post(excerpt) from specific category on wp page?
- How To Keep Posts from Being Displayed Two or More Times on My Homepage? [closed]
- How to restore permanently trash page? [closed]
- Custom Blog Post Page
- Creating a Page of Posts
- post-page: reference to parent page?
- Dashboard :10 Last draft page and 10 last pending review page (metabox)
- page.php showing loop of posts and not page content
- Can I divide the pages into categories?
- How do I get blog posts to appear within CMS?
- Drag posts and pages so you can sort them in order
- How to include the latest post of a specific category on a matching page
- post categories
- Integrate OpenStreetMap on WordPress
- What’s the best way to render Visual Composer in posts, not pages?
- Overwrite posts/pages via import
- Auto-realod with new posts // Ajax call
- Start post pagination at 0 instead of 1
- Is there a way to specify an extra class for a post or page with no title?
- Using wp_list_pages() after calling query_posts()
- Display Posts on Custom Page
- Multiple Loops Breaking Pages
- “about us”, ” contact” sections should be article(post) or page in the simple small Business website?
- disable Tab post on nav-menus page (Admin)
- Proper way of establishing custom landing pages in WordPress
- Admin – no Featured image choice in create new/page|post
- Why won’t pagination work?
- How to add some html formated text to every new post in WordPress
- Output Post with ACF Fields into other Post
- Posts and Pages: 404 Page not found
- List all posts, pages and custom post types in admin
- Make ‘blog’ page show content as well as posts underneath it
- Are post, page and category IDs unique to each other?
- Setting limit to posts or page creation
- Create a frontpage.php and static page template
- Using Posts Like a Page
- Pagination for normal (standard) posts on a page with a custom loop?
- post/page content
- WordPress Architecture as a CMS – Posts & Pages
- How can I add a page that shows posts from a single category?
- How to show next/prev link, when it’s not active?
- Prevent 404 of Author pages without posts
- Cannot publish posts, but can create new pages
- Making a new post visible on a specific page
- Can I restore restore content from old Worpress site to a new Worpress site from an archive
- How Do I Redirect WordPress Pages but not posts?
- Automatic duplicate/copy of post to a related page in WordPress
- Custom Fields – How to get the list of a specific active widget each time it rendered
- Yoast breadcrumb URL shows category instead of the page
- How to show only homepage in google results instead of privacy, contact pages
- Google indexing duplicate page content with Page #### in post title and /page-2 in permalink instead of the ones I set
- Nestling Posts Under Page & Justify Text
- Show post count in custom taxonomy page
- How to show WP admin edit page within template page/post?
- Display all tags even if they are not assigned to a post
- Disable pagination in posts and pages
- Bulk Post update_post_meta
- Very weird behaviour after removing WP pages
- Category URL to use same string as Post URL Permalink
- Posts on Sidebar only
- How do I make it so that new posts within a certain category go into a certain page?
- Hide Admin posts & pages in Dashboard
- structure of posts and pages
- Call posts of particular category in a page
- Add custom class to existing menu items from custom meta
- Add wp-link-pages to post
- Allow users to create their own page/s
- some posts being displayed as pages
- How to arrange different post categories in template
- Make Show Notes for Individual Podcast Episodes Easy to Find (multiple URL’s?)
- Get part of a page url
- can’t post immediately
- Displaying only posts from a certain category on my custom page template
- Where are my posts linked to? I keep getting a Not Found Error, and I have no single.php page
- How to Post to Specific Pages?
- associate posts to a page
- Woocommerce – custom post type of checkout page
- How to have more post in a page than in your home page
- Custom post page has attributes of latest post [closed]
- WordPress “Posts Page” isn’t showing template dropdown
- How to have 2 posting pages on a blog
- change page name on page list
- Automatically search and replace link in content (pages/posts)?
- How to remove slug from CPT correctly?