is_singular returns true on a list of posts

[ad_1]

Hello,

When I create a list of my custom post type and use a filter for the_content the function is_singular() returns true, even though it is a list of posts. Is this a bug in the plugin, or in WP_Query?

I am using this shortcode:
[display-posts post_type="cs_chessgame" include_content="true"]

This is my own plugin with chessgames:

This is the filter for the_content which should only add data when it is a singular post:
https://codeberg.org/cyclotouriste/chessgame-shizzle/src/branch/trunk/functions/cs-content-filters.php

And here is my workaround to not run these filters when using Display Posts plugin:

Some example code to test:

function display_posts_test_is_singular( $content ) { if ( is_singular() ) { $content .= '<br /><pre>is_singular is true.</pre><br />'; } else { $content .= '<br /><pre>is_singular is false.</pre><br />'; } return $content;}add_filter( 'the_content', 'display_posts_test_is_singular' );

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer