fix(report): give preset reasons a stable non-empty slug for CJK labels
ban_settings() derived each reason slug via sanitize_key(label), which strips CJK text to an empty string; the frontend filter then discarded every reason (including the schema defaults) and fell back to the hard-coded list. Derive the slug from an ASCII key when possible and from a stable md5 short hash of the label otherwise, and relax the frontend filter to the label only. Adds a WP-stub harness that verifies the defaults path end to end (tests/dev/verify-ban-settings-defaults.php).
This commit is contained in:
+1
-1
@@ -41,7 +41,7 @@
|
||||
name: String((cat && (cat.name || cat.label || cat.t)) || ''),
|
||||
};
|
||||
})
|
||||
.filter(function (cat) { return cat.slug !== '' && cat.name !== ''; });
|
||||
.filter(function (cat) { return cat.name !== ''; });
|
||||
if (items.length) return items;
|
||||
}
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user