• 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.js

    The error occurs on this line:

    window.acf.data.wp_version.localeCompare("6.9", void 0, { numeric: true })

    In some cases, window.acf.data.wp_version is undefined at the time this code executes, which causes the uncaught error. It appears to be a race condition (possibly related to requestIdleCallback / setTimeout timing).

    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

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.