[wp-trac] [WordPress Trac] #52537: is_single is_singular is not working

WordPress Trac noreply at wordpress.org
Tue Feb 16 10:58:34 UTC 2021


#52537: is_single is_singular is not working
--------------------------+-----------------------------
 Reporter:  BackuPs       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52537>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list