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 to make WP_Query ‘post__in’ accept an array?
- Merging multiple wp_query objects
- Query causing load because of SQL_CALC_FOUND_ROWS post counting?
- Using custom meta_query with relation not working as expected
- Nested query inside Logical operator OR not working in meta_query
- SQL Statement generated by WP_Query not producing expected results
- Only show first post to match certain criteria within WP_Query
- How to order a post type with meta_value_num and if meta_value_num does not exist then order by date
- difference between $wp_the_query and $wp_query? & getting the values properly [duplicate]
- Custom Field sort not working (WP 3.8.1)
- Get post ID’s from one query and exclude from another
- What are the differences between “Latest Posts” and “Static Page”?
- WordPress Query is taking more then 20 second and stuck on creating index
- Modifying raw $_POST data early in the lifecycle
- Get the Plugin Which Triggered a MySql Query in WordPress?
- Difficulty with rewrite rules
- Show selected images on top in Media Manager
- showing all search result in one template
- Large AND OR query timing out
- Categorising search results based on Custom Fields
- How to query for all posts that have a particular meta key?
- Ajax future single post query doesn’t work when NOT logged in
- WP_Query Taxonomy categories filtering
- The best way to store variable across different widgets
- Assign a minimum result count for WooCommerce query shortcodes?
- WPQuery calling specific posts problem
- Retrieve data from wordpress db via input and put those result in dropdown
- Limit loop to future events
- How to access $wp_query object from array of posts given by get_posts?
- Custom wp_query differs on index page and category page
- WordPress Queries Not Working?
- Links in the_content not linked
- how do I write this wp_query select statement?
- Exception for excluding previously displayed posts in queries
- Post incorrectly excluded when using “category__in”?
- Block internal search queries with pre_get_posts and regex rules
- Is it possible to give a classname to specific comments in the WordPress admin?
- Is there documentation for objects returned by WP_Query?
- show image gallery in archives or category page
- Custom post type loop error: Trying to get property of non-object
- Search Field that allows options of “Match any keyword” or “Match all keywords”
- Getting the last X posts, but in ascending order of time
- Show more than one post on the main page excluding certain category
- How to make a wordpress loop file that displays posts based on certain conditions
- How do I display posts with specific value in a custom field into my loop?
- Order by multiple meta keys on wordpress
- Sort posts in dashboard using custom field; also include posts where field isn’t set