Opened 3 months ago
Closed 3 months ago
#63039 closed defect (bug) (fixed)
Incorrect type for the $public parameter in 'robots_txt' filter
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.8 | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | has-patch commit |
Focuses: | docs | Cc: |
Description
In the robots_txt
filter, the $public
parameter is documented as bool
. However, in practice it's a string, either '0'
or '1'
, retrieved from get_option( 'blog_public' )
.
We should either cast the value to bool
for the filter, to match the documented type, or correct the documentation.
Attachments (2)
Change History (7)
This ticket was mentioned in PR #8439 on WordPress/wordpress-develop by @kapilpaul.
3 months ago
#2
#3
@
3 months ago
Since we are already checking $public as a boolean in other functions, it makes more sense to cast it to bool before passing it to the filter. This ensures consistency, prevents potential type issues, and aligns with the documented type. Updating the documentation instead of casting might introduce inconsistencies in how we handle this value across different functions.
Patch Added.