is_singular
only accepts one argument- post type. It’s only for checking if a post is of a certain type(s), not a specific post of that type. Check $post->ID
instead-
if(is_singular('guides' )&&($post->post_parent==$pid||$post->ID==$pid))
I would also consider using get_queried_object()
and/or get_queried_object_id()
rather than use the global $post
.
Related Posts:
- Get The Post Type A Taxonomy Is Attached To
- Meta query with boolean true/false value
- Custom Post type & Taxonomy URL structure
- Custom Post Type – Taxonomy Dropdown Menu?
- How to add multiple images to custom post type?
- Set custom upload path for custom post type only?
- Two Custom Post Types, Share Two Taxonomies
- User roles – enable custom posts disable posts
- Remove CPT slug from URL
- WordPress Gutenberg-Block with ESNext (withState, withSelect)
- Date query for a custom meta field
- How to show custom post type count in the users admin page
- Importing posts in custom post type into new website
- Timepicker-addon doesn’t show – Datepicker works fine?
- Registration and Custom Post Types – How to synchronize information?
- different template for first and second level custom post page
- Query for multiple post types does not work
- How-to leverage WordPress for creating Extended Social Profiles
- Add custom post type to Backbone collections
- Link users to a custom post type
- pagination redirecting from page number url before page requested
- How To Create A Custom Taxonomy 404 Page
- Query Multiple Taxominies Across Multiple Post type’s
- How to enable shortcodes in a custom post type?
- Ajax Check Post Status
- Stop / prevent WordPress from updating permalinks of custom post type
- Custom post types and tag archive pages/permalink structure issue
- Tag Archive for Custom-Post-Type Posts yielding 404 when permalinks set to postname
- Allow non-logged in users to see a future post after clicking on a list of future posts
- How can we take into account post types when constructing permalinks?
- Problem querying Custom post type by custom fields
- Posts Categories Are Showing In The Custom Post Type Category
- Custom post type showing index.php
- How to create a gallery page with categories?
- Get post count for search result based on post type
- Modification of how the data is controlled/showed and stored
- Display taxonomy terms, child terms and posts in a template
- How to run filter only on custom post type edit screen
- can these 3 queries be re-written as 1 query?
- cannot override post_types in WP_Query()
- Wrapping x posts in html without leaving empty html
- Page not found for custom post type UI plugin and taxonomy
- How to Get the title of a custom field?
- How to customize work area / admin area in a custom post type without plugins?
- Make homepage the newest post of a custom post type
- Add “Select All” to custom taxonomy
- Post loop count is not in order
- Insert Custom Post Types
- How to inherit field value from parent post into in child / sub post
- how to show records that don’t have custom meta value
- Want a custom query with just one category but from all custom post types
- WordPress CPT custom custom label
- Only show columns in custom post type?
- Filter content in shortcode
- Query custom post types & Taxonomies and list them in a table on a page
- Filtering custom posts by custom fields (ACF) [closed]
- add custom tags for custom post type in wordpress
- Modify a plugin function output from another plugin
- Display custom-post type based on the Title matching the current selected value
- Filter search posts by post meta?
- Yelp-style geographic directory plugin?
- Modifying search results based on post_type
- WordPress general content best pratices
- Is it a connection or relationship between 2 custom post types?
- i want to send email to user when the custom taxonomy is changed
- Faking “Same Slug Root, Multiple Custom Post Types” with Redirects?
- Issues with static pages redirecting towards home.php
- How to apply multiple rewrite_rule to a single custom post type url?
- Custom post type template – add banner under heading
- Custom post type single page returning 404 error when sharing archive url with custom taxonomy
- Query first and last name from custom post type
- How to get current post type?
- How to convert Post Object Custom Field into Tags
- WP Query filter search. Result show all posts instead just custom post type
- Subpage with custom post types inside another cpt
- Custom Post Type single post type shown in theme single.php
- save_post affect creation and deletion
- how to allow subscriber to add/edit/delete custom post type
- Page as parent for CPT and other pages
- Change the url of a custom post type to include taxonomy
- How to display all custom fields associated with a post type – IN THE ADMIN AREA?
- Different taxonomy.php for different custom post types
- How to keep a CPT stick to specific position?
- Custom post type issue
- How to query posts by meta keys AND under specific category?
- Add multiple custom meta boxes to different custom post types
- how to load custom single.php?
- How to show a custom taxonomy using a custom template
- Custom post types & Thumbnails
- Strange behaviour using 3.8.1
- I want to split this into two functions
- Repeatable Custom Field for Media Upload
- Change position of Post Formats box?
- How to store datetime from custom meta box so that it can be sorted by
- Add HTML before a specific div?
- Front end post or photo or both
- Is there any way of not using my_init_method in the following code (that creates a custom post type)?
- Display ONLY ONE $term (Out of 4 terms) from a Custom Taxonomy and CPT
- How do I add the “orange counter” next to a Custom Post Type?
- Custom slugs with dates & IDs on Custom Post Type