[wp-trac] [WordPress Trac] #59020: Critical error during database update and patterns directory

WordPress Trac noreply at wordpress.org
Wed Aug 9 11:08:20 UTC 2023


#59020: Critical error during database update and patterns directory
---------------------------+-----------------------------
 Reporter:  margaritaperc  |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  General        |    Version:  6.3
 Severity:  critical       |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 Hi there,

 The following critical error is triggered when WordPress updates the
 database, for example now with 6.3.

 My theme is using the patterns directory to define patterns. When i echo a
 constant - that is defined in the theme's functions.php - to one of the
 pattern files, I get a critical error (undefined constant) during the
 update process and cannot be complete it. The reason is probably, that
 WordPress loads the patterns directory during the database process, but
 not the functions.php.

 This is an example of the pattern file (path-to-theme/patterns/pattern-
 example.php):
 {{{
 <?php
 /**
  * Title: Pattern Example
  * Slug: theme/pattern-example
  */
 ?>

 <!-- wp:paragraph -->
 <p><?php echo esc_html( THEME_CONSTANT ); ?></p>
 <!-- /wp:paragraph -->

 }}}


 If I define the constant earlier, for example in the mu-plugins, the
 problem is solved.

 Let me know, if I need to provide more details

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


More information about the wp-trac mailing list