[wp-trac] [WordPress Trac] #59176: functions.php loads more than one time at one refresh

WordPress Trac noreply at wordpress.org
Wed Aug 23 14:57:36 UTC 2023


#59176: functions.php loads more than one time at one refresh
--------------------------+-----------------------------
 Reporter:  skarabeq      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  assigned
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  major         |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I have added into functions.php the function that adds into wp-
 content/debug.log text. So if I'm into wp-admin part it store only one
 time per refresh, but if I'm outside admin It call the functions.php more
 than one time. You can do it with the following code:

 {{{#!php
 <?php
     function write_log($log) {
         if (true === WP_DEBUG) {
             if (is_array($log) || is_object($log)) {
                 error_log(print_r($log, true));
             } else {
                 error_log($log);
             }
         }
     }
 write_log('Test log: ' . date('Y-m-d H:i:s'));
 }}}


 If I create a custom plugin the situation is the same.

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


More information about the wp-trac mailing list