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

WordPress Trac noreply at wordpress.org
Fri Nov 19 11:43:34 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:
---------------------------+-----------------------------

Comment (by domainsupport):

 OK, great!!

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

 Sorry about the double negative ... what I meant was I'm not sure why the
 value would be anything other than "-1" if CSS was not required. Surely a
 positive integer would infer that a custom_css custom post type post
 should exist ... or is there somewhere where this post might be deleted
 without the custom_css_post_id theme mod being updated to "-1"?

 But I agree with you that, on reflection, the theme.php file shouldn't be
 checking for database errors. It's a shame that get_post() doesn't
 differentiate between an empty result and a database error (by returning
 an appropriate WP_Error object rather than null for example).

 > 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.

 Totally agree with this ... although ... would this require input from the
 FSE theme component team as I don't believe they've yet decided what to do
 with the potentially soon-to-be-redundant  "Customizer - Additional CSS"
 AFAIK ... ?

 Oliver

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


More information about the wp-trac mailing list