You can use the following instead,
if (is_singular('post')) {
//your code here...
}
Where by is_singular
is the WordPress API conditional function for testing for the existence of a post type. You can also pass an array of post types if you wish.
Related Posts:
- Disable single post page
- Post type no single page
- Defined function isn’t showed on page
- Making a wordpress page print friendly
- Insert Shortcode exactly at the end of the content
- Show Next/Previous without Link
- Get post meta retrieving wrong value
- Adding a user’s ID behind the tag ref link address
- Single Post in Tab/Slider
- The_excerpt() doesn’t parse – how to change that?
- How to only publish posts with image in it
- Isn’t the way posts are displayed very unefficient?
- Add custom text automatically on each post
- How to check in functions.php if there is data in a WP_Query?
- restrict incrementation of post vies count when refreshing the page
- WordPress 302 Redirect to Random Product/Post/Page
- Getting Whitescreen when publishing a post [closed]
- Using system date format
- get_previous_post() while accounting for sticky posts
- Get post by tag
- Add code to a specific post’s content
- Related Posts function not working
- the_content() Not Grabbing All Content
- Un-highlight Blog Menu Item when Category Menu Item is Selected
- Is it advisable to use $post->comment_count instead of get_comments_number( $post_id )
- Related Posts: Changing Function For Posts Per Page
- Query function not executed between element [closed]
- Optimize CPT-function with a loop
- saving/reading custom field value does not work – no value gets POSTed
- wp-link-pages in header and footer of the post
- Same post appears in related Posts?
- Internal linking to posts permalink fail because of spaces and stripe at postname
- Have h2 tag not show up if there are no blog posts
- Changing wp_link_pages() to “Next Page” and “Previous Page” buttons?
- Attachment image single page
- WordPress as CMS: How to manage/handle images assigned to a post as full-sized background images in a slideshow?
- Nest Next and Previous in a href with class that has a background image
- WordPress single.php different layouts projects / posts
- Can I style single post that are in multiple catergories?
- “Home” Page now only displaying the single latest post
- Help on conditional statement to accompany wp_insert_post function please?
- How to implement a WordPress comments function?
- How to add content above footer in posts from specific category
- Set Default Post as Parent Child (Nested) Relation
- How to save template data into wp_post table (post_content column)
- WordPress – When visiting a `single post/ single.php` my category menu item link becomes active
- I need to create “View Profile” and “Edit Profile” links by incorporating the Post Title/ID, but can’t seem to manage it
- how to show comments only author which send own posts in wordpress
- get category in list of posts // shortcode for custom related posts
- shortcode // get posts by ids
- How to put the author of the post in the comments?
- How do I change the template specifically for single posts?
- Check if almost 10 year old – working code is up to date
- Alt text attributes not showing over portfolio images
- Show single post child category from a determined parent
- Find most used words in post titles
- WordPress Sticky Post Count “Fix” Breaking Pagecount by 72 pages!
- $post->post_content empty while all other properties are correct
- Function is printing twice – any suggestions?
- How to add a custom class attribute into code wrapper? [duplicate]
- out of nowhere
- WP posts using index.php instead of single.php
- Remove pagination if search returns empty
- Remove HTML tags from all posts
- How to center all text body in single.php at once?
- Set a post expiration and delete a post when expirate
- Single post shows post three times
- I want to change the WordPress comments file
- Replace Tag Keyword With Link Within Post Content
- Excluding tag Link from html tags in Post content
- Save All Post Permalink From A Specific Category into a .txt file
- How do I check if a post is password protected?
- Changing a users posts to drafts upon role change
- AJAX load more posts not using correct category and repeating the same few posts
- How to Display Most View Post in the template file?
- display multiple posts and posts content on a single URL
- Get post id outside loop : Notice: Trying to get property of non-object
- Show post excerpt
- How do I apply a wordpress function to something with no ID inside an archive page?
- Show all posts from the tags without having to set all of them
- Show author bio box
- How to correctly escape data
- Display author bio box
- Pagination for single post
- Check if user has avatar
- Trim excerpt to first paragraph
- im trying make a function to auto correct posts when i open the posts in the backoffice
- Get the category of post
- Only show related posts when another post has same term
- List posts of assigned categories in list of all categories on single.php
- How to change number of posts shown on homepage vs other pages?
- Is possible to do this from function.php
- Custom Single Post Type not referring to single-post-type.php File
- Show only top 3 posts from 3 categories in order on home page
- Hide Certain Tags on Single Post Page
- Call image from post on index page?
- Thumbnail With Next/Prev Links Not Showing Next Post?
- How to edit label_submit styling?
- How do I get thumbnails?
- Run function after post is updated