In your example, you can’t.
Per the Codex,
[
is_single()
] checks if a single post of any post type except attachment and page post types is being displayed.
You’re trying to use it on the transition_post_status
hook, which is not related to page display, and so is_single()
has no meaning.
The Solution
Instead of using is_single()
, use get_post_type()
:
if( 'post' == get_post_type( $post ) ) {
// code goes here
}
Related Posts:
- Keep featured content post in homepage with original order
- How to change the case of all post titles to “Title Case”
- Adding additional data to WP_Post object
- How set featured posts using checkbox in post edit screen?
- using wp_update_post on save_post
- WordPress plugin to publish to multiple remote WordPress blogs
- How do you get all the urls of images attached to a post?
- Get names of authors who have edited a post
- Display posts by tag on page
- How to batch update post content with custom post meta value
- How to wrap every image in a post with a div?
- Showing random content / pictures from earlier posts in a sticky post?
- Custom wp_trim_words() function not trimming right
- How to remove bulk edit options
- How to create post in WP network using WP-CLI
- Do I use custom post type or something else?
- How can I hook into creating a new post and execute wp_die(), before the post is inserted into the database?
- Function to show random posts from a category
- How do I add a reusable block to a programmatically created post?
- ‘Invalid post type’ error when importing from one site to another
- wp query with dynamic taxonomies and terms?
- How can I hide the sidebar from a specific post?
- move blog posts from one wordpress to another
- The ‘https_local_ssl_verify’ filter
- How to run a function when post is edited or updated using publish post action?
- Locked/Unlocked in title
- How to permanently delete a post meta entry?
- How can I remove posts of a certain category from homepage after a specified time period?
- WordPress’ visual editor messing up my (nested) lists (and other things as well)
- Disabled wp-cron, set up system cron but still have missed schedule posts
- Create dropdown list post
- Show featured image next to post-teasers in Genesis Framework?
- I would like to give special promotion for the first 100 posts in my blog? Can anyone tell me how to do that?
- Make view count for pop up post
- add_rewrite_rules for type of post
- Trigger a Link once a new post is Published
- Edit custom post type admin menu link
- Display Published Posts Count for Certain Time Period
- get_the_content(“more…”) returns full text
- How to load a post into an empty div tag anywhere across the pages?
- What is the filter or hook to add admin controls to posts on the front end?
- How to display Common posts from specific Tag & Category with Shortcode
- How can I get the media inside a post?
- Permission issue with custom post type – not added to menu – by plugin
- Get Page ID of blog homepage
- Order posts alphabetically: how to set order=asc in mysql query?
- How to order posts in an arbitrary order?
- Trying to alter the post_content through the_post
- How to rate a post from Admin Side / Manually?
- Images inside post title
- How to get ID of the page included with get_page()?
- save_post hook is not called when post is saved
- Howto show comment count by post in post?
- How to add a class to each individual post?
- Summary of Posts by an User
- ACF to select posts not displaying on blog page
- Check if current user has a post and that post has any term/s from a specific custom taxonomy outside the loop
- How to have more than one page for your posts if you have 8 posts but can store max 4 on a page
- How to remove “» (title of post or page)”?
- Extract wordpress posts content and category content
- WordPress loop not working on static front page
- Sidebar on single.php not showing up
- Multiple Blog Pages
- Closest post to a date
- Adding if statement into the_content()
- Change modified date to current date when title updated automatically
- how to find the posts page
- How to edit a custom theme?
- Aligning images in the wp editor not working. How do i get this to work in custom theme?
- Showing Posts if non are found
- how to Update guid = “text”+post_name?
- SQL DELETE multiple post_meta on single and multi-sites
- How to put the author of the post in the comments?
- How to Best Create Separate Subscribers and User Experience
- Filtering private Posts
- Post not using taxonomy template
- Diffrent layout for posts [duplicate]
- query posts with selected post ids first
- How to display related post from same category in single.php
- How to prevent WP from inserting empty posts
- Save All Post Permalink From A Specific Category into a .txt file
- How to get value of a selected option from select tag and use it in WP_query to filter posts?
- Using WP page password protection as defacto login
- get current index of post content in category page
- Permalink structure for two seperate blogs
- wp_query args with relation
- How do I apply a wordpress function to something with no ID inside an archive page?
- Keep highlight on menu item with post pages
- Can’t get post_updated hook to work
- Add new post only in assigned category
- How to retrieve custom field values and save again as array
- How to change post template via url?
- WP Query between posts custom fields [duplicate]
- How do I list categories and the common categories for posts beneath those categories?
- include other content type post ID not working
- Notify Author of the post if admin deletes his post and perform some function
- How to remove a date from wordpress post
- wordpress pinboard theme [closed]
- How to make the Post Author name fixed as “Editorial Staff” even if there are multiple authors?
- Trying to create parent for post. I need some help. Thanks