Opened 6 weeks ago
Last modified 6 weeks ago
#63257 accepted defect (bug)
sanitize_term_field missing default $context value
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.9 | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | has-patch |
Focuses: | Cc: |
Description
As per the inline documentation of the sanitize_term_field()
function, a default $context
value should be passed in the function arguments.
Change History (5)
This ticket was mentioned in PR #8670 on WordPress/wordpress-develop by @dilipbheda.
6 weeks ago
#1
#3
@
6 weeks ago
@audrasjb You're right, but I noticed that the documentation mentions a Default
value, which implies that if the last parameter is not passed, it should default to the 'display'
context.
Ref: https://tinyurl.com/22neh87o
Or we can remove the default value mentioned in the inline docs.
#4
@
6 weeks ago
Defining the default $context = 'display'
avoids errors if the function gets called without the $context parameter so it's making sense to me. For that reason it will be possible to also call the function with only the first 4 parameters, if needed. Also it is clearer in regards to the inline documentation.
Hello and thank you for the ticket.
I may be wrong but to be honest, given the default condition passes through a simple
else
statement, I cannot see much value to pass the default value. It is not used anywhere in the function.