[wp-trac] [WordPress Trac] #55942: Add a "value type" parameter to get_option() and get_metadata()

WordPress Trac noreply at wordpress.org
Fri May 5 22:03:00 UTC 2023


#55942: Add a "value type" parameter to get_option() and get_metadata()
-------------------------------------------------+-------------------------
 Reporter:  azaozz                               |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  6.3
Component:  Options, Meta APIs                   |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests needs-      |     Focuses:
  testing                                        |  performance
-------------------------------------------------+-------------------------

Comment (by flixos90):

 Replying to [comment:70 azaozz]:
 > As I mentioned three times already, `register_setting()` is intended for
 use in the UI. That means it is for "settings" from HTML form elements.

 I'm sorry but this is not correct. You're referring to what
 `register_setting()` was intended for use originally, but that hasn't been
 the case since 4.7, so at this point for longer than 6 years. The function
 is also responsible for various low-level aspects around options, like
 default values, or the type e.g. to describe the parameter in the REST
 API, neither of which is directly UI-related.

 Again, I'm personally not saying we have to use `register_setting()` but
 it is still a valid consideration. But that's only the second step to
 decide.

 Regardless of whether we use that function or another new function, what
 is your concern with handling the database type for an option centrally? I
 haven't seen any argument against that so far in this ticket.

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


More information about the wp-trac mailing list