[wp-trac] [WordPress Trac] #54443: Database Error Breaks "custom_css_post_id" Theme Mod

WordPress Trac noreply at wordpress.org
Fri Nov 19 05:16:07 UTC 2021


#54443: Database Error Breaks "custom_css_post_id" Theme Mod
---------------------------+-----------------------------
 Reporter:  domainsupport  |       Owner:  (none)
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Future Release
Component:  Customize      |     Version:  4.7
 Severity:  normal         |  Resolution:
 Keywords:  needs-patch    |     Focuses:
---------------------------+-----------------------------
Changes (by dlh):

 * keywords:  close => needs-patch
 * milestone:  Awaiting Review => Future Release


Comment:

 Thanks for providing this context and feedback, @domainsupport!

 As a procedural matter, note that the `close` keyword acts more like a
 suggestion for other maintainers and for the core developers, as opposed
 to a resolution.

 Your point about the unusually visible effect of the problem is well-
 taken, so I've switched from `close` to `needs-patch` to solicit
 approaches.

 > when there really isn't any custom CSS post for the ID in the option
 (not sure when this would be the case TBH)

 The custom CSS post isn't created until custom CSS is actually saved in
 the Customizer. For sites that never use the Customizer or custom CSS,
 don't provide access to either, the expected ID would be `-1`.

 > Is there a way to confirm that the custom css post was not returned from
 the database because it didn't exist and not because there was an error
 ... ?

 Possibly. It does seem a little out of scope to me for that function to
 try to diagnose potential database problems at the point in the request
 lifecycle when it usually runs, which is in the middle of rendering a
 template.

 But your question got me thinking: Perhaps a custom CSS post should always
 be created when a theme is activated. That would remove the need for the
 query entirely, and if the query did happen, an empty result would be
 clearly suspect.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54443#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list