JavaScript error in admin – wp_version undefined (SCF 6.8.0 / WP 6.9.1)
-
Hi,
I’m experiencing a JavaScript error in the WordPress admin when using Secure Custom Fields 6.8.0 on WordPress 6.9.1.
Console error:
Uncaught TypeError: Cannot read properties of undefined (reading 'localeCompare')
at scf-admin.min.jsThe error occurs on this line:
window.acf.data.wp_version.localeCompare("6.9", void 0, { numeric: true })In some cases,
window.acf.data.wp_versionis undefined at the time this code executes, which causes the uncaught error. It appears to be a race condition (possibly related torequestIdleCallback/setTimeouttiming).A simple guard like checking for existence before calling
localeCompare()would prevent the issue, e.g.:const version = window.acf?.data?.wp_version;
if (typeof version === 'string' && version.localeCompare("6.9", undefined, { numeric: true }) >= 0) {
...
}The issue happens across multiple admin pages (not limited to SCF screens).
Let me know if you need more details.
Best regards
You must be logged in to reply to this topic.