If you really think the is_singular() function of your query should be returning true for singular but isn’t, you can force it to be true by setting the public property is_singular directly after the query, since that function just returns the value of that property when no $post_types parameter is specified:
$the_query = new WP_Query($args);
$the_query->is_singular = true;
Or if you need to do so for the main query:
global $wp_query;
$wp_query->is_singular = true;
I can’t speak to the wisdom of whether or not this should be done—it probably depends largely on your implementation—but it can be done since that property is public.
Related Posts:
- $wp_query initiation?
- get_children() Archive Template
- Page template query with WP_Query
- How to prevent execution of default query, while preserving ability to use WP_Query in template?
- How to stop wordpress to make the default query?
- Executing Queries in tag.php
- Custom archive page based on array of categories and tags
- Which custom query am I in and how can I access its properties & methods?
- Single page theme
- Pass the same object to multiple widgets in a template with one query
- Tell wordpress to show a single page instead of an archive
- Have functions work outside the loop with 404 override
- List of the years with posts presented
- Show all post for a given category
- From where is archive.php getting its posts?
- Display posts from only one post form in custom query and exclude in main query
- Remove category from query (show all posts in archive.php) pre_get_posts()
- add_filter(‘query_vars’) not working in custom template
- Two loops on archive page
- How to order posts by title after they have already been sorted by category
- Filtering out child category posts from parent category archive not working
- Is there a better way to pull in custom content without querying posts?
- WordPress Custom Search Form Displaying Unexpected Results
- Is there a way to make this kind of loop shorter and nicer?
- Display if author page is author page of current user
- Utilising an existing page while using the “s” query parameter
- Filtering posts by archive showing all years
- Get posts in taxonomy randomly
- How to generate feed for custom template
- Creating attachments archive in tags and categories
- Post archive for certain post format
- Unable to paginate a custom page query
- Creating ‘posts page’ loop based on the page itself
- How to stack name list in non-alphabetical order?
- problem with the loop
- Pagination not working on archive.php template?
- How do I stop the same post showing multiple times in a archive?
- How to display a post(by id) along with css in a page?
- ACF: using two loops, the_field returns field content from another loop
- WordPress custom query by archive title
- Search Filter With Custom Taxonomy and Custom Fields : How do I handle it via plugin?
- In Product Category archives how to show Posts having same/similar prod_cat slug structure?
- Show full category tree for a year with all post titles?
- How to allow Readers to Select Post Order?
- Get X posts for all post types on Taxonomy term archive
- Passing query variables to a custom page template
- How to add archives (with pagination) to page template?
- how to pass args for archive.php query?
- Adding css tweak based on page template
- Main loop querying current template’s info only in custom category archive pages, not my posts
- query only direct child and sub-terms of a current term archive
- the_excerpt() not working in custom archive
- on attachment.php, how to display previous and next attachment links that follow the same order as a custom WP Query
- How WP determines archive page vs single page?
- Block Editor – WordPress 6.1 – CPT Archive Issue – While the title changes in the loop, all records display the same data
- How to prevent random 302 canonical-ish redirect on custom template
- How to apply pre_get_posts to a custom query?
- WP_QUERY tax_query not working
- How to get latest post excerpt from a specific category?
- Which is from this queries is more faster
- Start Query from 2nd Post without offset
- Get all content on a “single page” site depending on language
- Get list of all Grandchild Pages
- Execute PHP function inside the admin area
- get latest added term from taxonomy and insert into php variable
- meta_query returning excluded result
- WP_Query: attachment image in “full” size?
- Featured images loop for Orbit Slider
- Filter subpages in while loop from WP Query object
- Attempt to display site authors in a carousel – User Image not Outputting inside li tags
- Adding pagination to sub-wp_query within a singular post page
- How go give $value to wp_query
- Show multiple tax_query from 2 or more post_type in a single code
- wp list pages using meta box value
- Add AJAX “Load more” on custom query block
- Disable (or limit) queries when certain content (or data) is not needed (or showed)
- get_var is neither a string, integer, or array …?
- Posts limit on homepage (genesis framework)
- How to filter a static post page with ajax and $wp_query
- Query not sorting DESC
- Use have_posts() with array of post results retrieved by $wpdb->get_results
- how to translate countries output from wp database?
- WP_Query with 2 genres
- wpquery via ajax
- Custom query does not find pages
- Deleting terms from the WordPress wp terms table
- Display posts from an array of ID’s
- Pagination problem by using WP_Query
- Date not appearing in custom query
- Custom taxonomy in WP_Query not working
- Custom post type – filter content by custom meta box content
- Trying to output content from page, works locally but not online
- Add category to my get_post query
- Ajax (jquery) wp_query pagination returns -1
- Why always one post missing
- Query WP Page for Buddypress Group Home [closed]
- How to sort by most watched in X days/months
- Admin: Custom Query Returning Permissions Error
- Using WP_Query with multiple loops on one page in search.php
- Modify output of custom loop using WP_query