Opened 22 months ago
Last modified 5 months ago
#58249 new enhancement
Improve "get_metadata_raw()" by Delegating "$single" Handling to Filter
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 6.3 |
Component: | Options, Meta APIs | Keywords: | has-patch |
Focuses: | Cc: |
Description
In the current implementation of the get_metadata_raw()
function, after obtaining the result from the get_{$meta_type}_metadata
filter, the code checks $single
and is_array()
and may return the first element of the result instead of the entire result. This can cause unnecessary ambiguity when the retrieved meta value from filter is an array which is serialized and stored in database.
It appears that get_metadata_raw()
assumes the get_{$meta_type}_metadata
filter will unserialize the meta value, but not handle the $single
parameter.
To improve clarity and efficiency, I recommend delegating the responsibility of handling the $single
logic to the get_{$meta_type}_metadata
filter. This change will streamline the get_metadata_raw()
function and provide more consistent handling of meta values.
#58992 was marked as a duplicate.