#52537 closed defect (bug) (invalid)
is_single is_singular is not working
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
Hi
i have a weird issue. If i use a clean install and add code like this in the functions.php of f.e. the 20-21 theme and go to the single post page in the front end that echo does not happen.
I am using the latest beta version of wordpress 5.7 and php 8.0
any idea why this is not happening?
if (is_singular( 'post' )) echo '---------------------------> this is a post';
if (is_single()) echo '---------------------------> this is a post';
if i add it without checking
echo '---------------------------> this is a post';
The text of course shows.
What is going on that this does not work in the functions.php on a single post page?
I tried any defaul wp theme and premium theme and they all have the same problem.
Attachments (2)
Change History (4)
#1
@
4 years ago
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
- Version trunk deleted
Hi @BackuPs,
Looks like this is a support question (in which context is_single/is_singular function can be used) rather than a bug/enhancement report. I'd suggest to ask in WordPress support forums instead: https://wordpress.org/support/forum/wp-advanced/
Thanks for your comprehension
code added at the bottom of the functions.php