[wp-trac] [WordPress Trac] #56078: PHP Warning when adding fonts to fontFamilies in wp_global_styles post

WordPress Trac noreply at wordpress.org
Tue Feb 21 15:39:25 UTC 2023


#56078: PHP Warning when adding fonts to fontFamilies in wp_global_styles post
---------------------------+---------------------------------------
 Reporter:  domainsupport  |       Owner:  (none)
     Type:  defect (bug)   |      Status:  closed
 Priority:  normal         |   Milestone:
Component:  Editor         |     Version:  6.0
 Severity:  normal         |  Resolution:  wontfix
 Keywords:                 |     Focuses:  administration, template
---------------------------+---------------------------------------
Changes (by hellofromTonya):

 * keywords:  has-patch needs-testing =>
 * status:  new => closed
 * resolution:   => wontfix
 * milestone:  6.2 =>


Comment:

 Replying to [comment:13 domainsupport]:
 > ''No wonder'' it was **so** difficult to find a way to inject fonts into
 the Global Styles interface! I've just read this on
 https://make.wordpress.org/core/2022/04/22/status-of-webfonts-api-for-
 wordpress-6-0-inclusion/ ...
 >
 > > This led to the decision to pursue a pared down version that only
 supports declaring fonts within a theme.json file, that is only available
 to theme authors, rather than to the wider extender base (i.e., plugin
 authors). To ensure this approach, the core of the API was put into a
 private theme.json handler preventing plugins from registering or
 enqueuing, bypassing the current performance and robustness concerns.
 >
 > So ... my bad for finding this loop-hole way to do precisely what is
 quite clearly not meant to be done but like you say, it is a bug
 nonetheless :)
 >
 > If it were up to me I would vote for custom multidimensional array
 unique function unless the Webfonts API is imminent ... ?

 I'm hesitant to change the current stopgap code in Core. Why?

 * It's temporary.
 * Injecting fonts is doing it wrong at this time, as the stopgap does not
 support nor was it designed for any fonts other than those in the active
 theme's `theme.json` file.

 Registering fonts is supported in the Fonts API being tested and refined
 in Gutenberg. This API will be introduced into Core in 6.3 which will
 remove this stopgap code.

 @domainsupport I invite you test and help with the Fonts API
 https://github.com/WordPress/gutenberg/issues/41479.

 I'm closing this ticket as `wontfix` since the injecting fonts is not
 supported nor intended.

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


More information about the wp-trac mailing list