Skip to content

Folder setting can't be saved from the settings page #639

@lithrel

Description

@lithrel

Hi 👋

Version 3.2.0
Probably since 6aee7ae#diff-5c6a7480a4ecf0cea0a218a7c1641b8537fe28f30624802307b8baab0fd749ddR525

When selecting the option "Single site" for "File URL > Folder" in the settings, the option is not saved.
I think it's because sanitize_text_field() returns an empty string if given an array, and root_dir is posted as an array (ie: sm[root_dir][] => "%date_year/date_month%"). The option ends up empty after sanitize and those lines are never executed.
Saving the options through the settings page after configuring this one through CLI also empties it.

I tested moving the sanitization after the array condition but it seems like WP function strips the first characters of the default patterns given, so %date_year/date_month% ends up as te_year/date_month%. Maybe we could skip sanitization of this setting for known values that are in $this->wildcards keys ?

Thank you for your work ❤️

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions