I can’t use is_singular( 'my_post_type' )
in pre_get_posts because the queried object is not set at this point.
I can use instead the post_type query parameter.
Related Posts:
- New post status for custom post type
- Customize Edit Post screen for Custom Post Types?
- Filter by custom field in custom post type on admin page
- Showing User’s Post Counts by Custom Post Type in the Admin’s User List?
- Multiple custom post types under one admin menu
- How can I change the admin search posts fields?
- Custom post type: Add “Edit | Quick Edit | Trash | View” links to date (if title is not shown in column)?
- Admin Area Custom Type Search By Meta Fields Without Title & Content
- How can I filter posts by post_parent in the admin?
- $query->set in pre_get_posts is unintentionally affecting the backend
- Create a dropdown with Custom Post Types as option in admin
- Filter admin columns by custom post field value
- Is it OK to move admin menu items?
- Add Custom Post Type to Current Query
- How to show more posts on an archive page?
- Custom post status and preview
- Include post id[s] into WP_Query()
- Pre get posts for single post
- Filter by custom Field for Custom post type Admin Listing
- Renaming Menu Item within Admin Menu Section for a Custom Post Type?
- Pre_get_posts Gives 404 on Custom Post Type
- How to get search results in the backend admin on a custom post type?
- filter search result with custom post type meta key
- Order posts by (hierarchical custom) taxonomy terms and term children
- Meta Query “IN” doesn’t work with ACF checkbox filter
- Unable to filter on field on edit.php page
- Can’t sort order of wp_query with 2 meta keys
- delete custom post based on custom field date
- No results searching custom post type in admin panel
- Error after deleting Custom Post Type with a function (no trash used)
- Actions that Run on Admin Edit Page Load After Posts Are Queried
- How to set default status to custom post type
- Change admin post thumbnail size for custom post type only
- Filters post in admin with dropdown select, custom post type
- Admin List Dynamic Heading
- WordPress User Roles, Custom Post Types, and Admin views
- Settings page above CPT page in admin section
- Display all Posts and only certain Custom Post Types with meta fields
- Building an Advanced Search (text, tags, category, custom fields) – Getting the wrong SQL query
- 1 day after custom date change post status to draft
- Changing ‘view’ link for custom post type on list post screen?
- How to customize admin posts based on the user who is logged in
- Issue with pre_get_posts on custom post type archive pages
- Add html to cpt main page / admin edit.php
- How to sort custom post type posts in default order by multiple fields?
- Custom post type show on both Home and Date Archive
- How can I create a custom meta box to add an mp4 video to a page?
- pre_get_posts on custom post type
- Remove rows in the manage post/page view
- Is there a way to have the view link on manage posts page to open in a new window or tab?
- Access $post object when adding custom columns to list table
- How to modify archive query with pre_get_posts to append CPTs?
- Multiple meta_values in the pre_get_posts filter?
- Get parse_query filter to return slug instead of id
- Custom post type search using $_SESSION and pre_get_posts
- How to add a custom-post-type post within another custom-post-type post edit screen using AJAX?
- On update or create post redirect to current post position in list
- Featured image overlay when changing post status
- Custom post type suppress transition from future to publish
- Admin Column does not populate with data
- Add custom post type drafts to RSS feed
- Edit Custom Post Type on Custom Admin Page instead Post Admin
- Add a ‘guide’ image to custom post type admin page
- Main menu not appearing in custom post type archive
- New “Custom Types” item in admin menu. Is this a plugin or a new wordpress feature?
- Programmatically change post visibility on save_post action return a 500
- Linking to Post Types from wp-admin
- Plugin or method of allowing user to rearrange custom post types with drag and drop?
- sortable columns for multiple custom post types not working
- Prevent A Specific Custom Post Type Showing In WP Search Results Page
- Filter posts of custom post type by meta key in (List All Section)
- pre_get_posts works in post type archive but not in single post
- Require custom post type if is_admin() – template doesn’t show up?
- using the loop in custom meta is messing up ‘add new’ post type
- WordPress admin for a custom post, hide/collapse the main “title” and “description” boxes
- Manually adding or updating CPT automatically sets post_status of future
- Change user role when user’s first post gets published
- Set Post Private if no linked Post Objects (ACF)
- Query to Exclude Child Pages from Custom Post Type Archive
- How do I troubleshoot pre_get_posts with Debug Bar?
- edit.php all post not working
- List all posts associated under custom taxonomy
- Custom Post Status not getting displayed after post update
- How to save post_status using action save_post?
- How to stop post status from reverting to Published?
- wp_insert_post() creates duplicates with ‘post_status’ => ‘publish’
- CPT year wise archive based on custom date Field
- Create an administation subpage containing posts in a certain category
- What’s the most efficient way to get two queries based on an if statement?
- Implement post status update as frontend news announcement
- Custom Post Status & Taxonomies
- pre_get_posts with multiple post types AND a meta_key
- Exclude categories For Custom post types
- Fetch post meta in the same query as the main loop
- Problem to show custom post type in archive page category wise
- Redirect preview single post link to a page
- Using $seed on a custom post type for randomly displayed posts
- How do I sort post listing by child post count?
- Collection of fields in a single post
- Display read only info on admin, custom post page