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’
- Show the First Post from Each of 3 Different Post Types on a Web Page?
- is_singular() not working if called via callback function of admin-ajax.php
- Retrieving 3 latest post from each of 5 different custom post types
- Exclude custom function content from certain pages
- Get template part based on custom taxonomy term
- If on term-page -> get the current term?
- changing default comment form arguments [duplicate]
- How to get only one category of custom post type?
- 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’
- Get random custom posts from a custom post type
- Quickest way to get last or oldest post date – WP Query
- is_page_template not working as expected
- remove child post from custom post type archive
- Filter the content from a post globally immediately after is fetched from the database
- Combine query_posts() and get_posts() into single query
- if custom posts type exists and there are posts load script
- Are there sub-systems in WordPress that would employ data structures beyond CPT that a `get_posts` won’t be able to catch?
- Shortcode for display posts on home page show only one post
- Need help targeting a custom post type with conditional tags
- Why would this IF statement not work? [closed]
- WordPress count child posts of each parent custom post type and use in json array for google maps jquery plugin
- 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
- Display latest x posts from all categories in Custom Post Type/Taxonomy
- 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?
- Conditional for a Single Post That Belongs to a Category?
- 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
- Custom query for custom post_type
- Recoverable Fatal Error – Object of class WP_Post could not be converted to string
- Conditional Tags for specific category of custom posts
- Move Genesis Single Page/Single Post Title
- populate array with posts
- 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
- Is it possible to use array_walk() to append terms to an array of posts?
- custom hierarchical taxonomy and custom post type list contains surplus posts
- Check if custom post is a parent?
- 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
- comments hooks on custom post type
- Can’t pull posts of a Custom Post Type based on the custom taxonomy of the CPT
- Conditional Statements
- 4 posts per page from single category
- If custom taxonomy else conditional [closed]
- If tag exists, then echo once
- Show specific content on parent custom post type and all children
- Query custom posts of logged in user only
- Display a random customposttype2 excerpt in single-custompostype1.php that shares same taxonomy
- 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
- How to query custom post types with multiple keys?
- date_query empty results with custom post type
- Orderby meta_key/meta_value not displaying anything, am I overlooking anything?
- get_posts() returns empty on custom post type /wp-admin/edit.php
- Get_post_custom not fetching value from array wordpress
- I’m having trouble with Related Product “tax_query” ‘terms’ value
- 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
- Get all posts by many custom post types
- Modify default Related Posts Code to Custom Post Type