Try using get_post_type()
instead:
if ( is_single() && 'post_type' == get_post_type() ) {
// Do something
}
The is_post_type()
conditional is deprecated. But even when it existed, it returned true if the current post is any registered custom post type. It has been replaced with post_type_exists()
.
Related Posts:
- custom post type upcoming post and past post
- How do test if a post is a custom post type?
- How to get post content by calling ajax?
- Conditional for single-{post-type}.php
- Get the ID of the latest post
- How to get all children and grandchildren of a hierarchical custom post type?
- Getting the Intersection of Two Custom Taxonomy Terms for a Custom Post Type?
- List most recent image uploads, but only for specific custom post type
- Get all authors with at least one post of ‘custom post type’
- Retrieving 3 latest post from each of 5 different custom post types
- Get template part based on custom taxonomy term
- If on term-page -> get the current term?
- changing default comment form arguments [duplicate]
- post__in not taking my list of IDs
- How to query custom post type by term?
- Getting a custom post type image using ‘get_post_custom’
- is_page_template not working as expected
- Need help targeting a custom post type with conditional tags
- Why would this IF statement not work? [closed]
- custom comments on specific post type
- Excluding custom post types
- How inefficient is it to use a Custom Post for 4-5 sentences & pull all to 1 page?
- Display all post titles of current post type
- Display content based on a users login
- Register widget only page is a singular of custom post type
- Is there a conditional tag to determine whether the post is _any_ custom post type?
- Conditional Query of Custom Post Type and custom taxonomy
- Stuck in Order by more then one
- Query Multiple Custom Posts by Custom Fields
- Multiple (two) category postings on the same page.
- ‘exclude’ argument is not working with get_posts for a custom post type
- How to get the intersection of two terms both from different custom taxonomies
- How to run filter only on custom post type edit screen
- Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms
- Custom Post Conditional for Parent & Child Single.php?
- Reworking function for counting custom post type posts count
- How to show only the most recent post on my custom post type archive?
- Get only used meta_values
- Number of posts in the archive
- Recoverable Fatal Error – Object of class WP_Post could not be converted to string
- Move Genesis Single Page/Single Post Title
- How to Make infinite loop of post
- How to check if post/page or taxonomy post is published by admin
- get_posts seems to be skipping the last Post
- TinyMCE Buttons on Certain Post Type
- Displaying multiple post types on home page
- Conflict between wp_list_pages and get_posts – list pages not displaying
- Display message if no posts in Custom Post Type loop
- Return number of all custom posts type by author in all statuses
- Showing taxonomy terms on custom post type
- Group by custom field value (start and end times)
- meta query not retrieving posts
- How to get custom post type title, excerpt, thumbnail and permalink by post ID?
- Get posts by category name
- Why the_excerpt() function returns excerpt on the Home page and trimmed content in sidebar?
- How to properly use Categories with Custom Post Types
- Redirect to URL if x number of days passed
- If custom taxonomy else conditional [closed]
- If tag exists, then echo once
- Show specific content on parent custom post type and all children
- Use conditionals with wp_enqueue_style to attach stylesheet according to post type displayed
- Getting the list of the latests posts and custom type posts in the homepage
- date_query empty results with custom post type
- get_posts() returns empty on custom post type /wp-admin/edit.php
- Custom post type data not displaying If I select the category from the dropdonw
- get_posts wont produce a list of custom type from a given category [duplicate]
- Limiting the Number of User Posts to Their Own Posts
- Modify default Related Posts Code to Custom Post Type
- Query a custom taxonomy in a function to create an csv file
- Query posts based on user preferences
- Error get_posts with Custom Taxonomy and OR relation
- Why get_posts() returns empty array while I am trying to get posts from some specific taxonomies and work properly with others?
- Get post from Category by Priority
- Running get_posts within get_posts to get children of children
- Certain number of posts with certain excerpt length
- conditional based upon the count of current user’s published custom posts
- Help ordering custom query by Title, Ascending
- This wp_query will not return any posts and only seems to work with post_status inherit?
- Custom metabox fields not saving when limited to a certain CPT
- Can not hook into custom post type template with: is_page() conditional?
- Popup panel is only displaying 1 entry ignoring all others
- Fetch posts list from fist CPT taxonomy term and list under 2. CPT
- How to create content automatically when a post is published?
- Query posts by a type and another type only if post is in specific category
- Diffrent search templates for different post types
- Conditional Tags If Custom Post Parent & Child?
- Custom Post Type children and grand-children in one list
- shortcode for recent custom type post
- Custom Post Query Combined with Conditional Tags
- How do I display the index position of a post from a custom post type?
- Conditional statement checking two conditions for CPT and Custom Taxonomy [closed]
- Custom Post Type meta value is being saved in array, instead of just the string (as value)
- strange conditional tag behaviour [duplicate]
- Display posts from another page on home page in wp-editor
- show custom post’s post in two different divs [duplicate]
- Add Category names to post lists of custom post type
- How to I add count of custom posts listed in a post as a prefix to its title
- How to get permalink of post based on post name?
- Create a hierarchical list of posts that’s grouped and nested by category
- post__in select all custom posts and not the selected array of ids