WordPress/WordPress · error · TypeError

Third argument must be a Function

Error message

Third argument must be a Function

What it means

Error "Third argument must be a Function" thrown in WordPress/WordPress.

Source

Thrown at wp-includes/js/clipboard.js:627

 * Validates all params and calls the right
 * listener function based on its target type.
 *
 * @param {String|HTMLElement|HTMLCollection|NodeList} target
 * @param {String} type
 * @param {Function} callback
 * @return {Object}
 */
function listen(target, type, callback) {
    if (!target && !type && !callback) {
        throw new Error('Missing required arguments');
    }

    if (!is.string(type)) {
        throw new TypeError('Second argument must be a String');
    }

    if (!is.fn(callback)) {
        throw new TypeError('Third argument must be a Function');
    }

    if (is.node(target)) {
        return listenNode(target, type, callback);
    }
    else if (is.nodeList(target)) {
        return listenNodeList(target, type, callback);
    }
    else if (is.string(target)) {
        return listenSelector(target, type, callback);
    }
    else {
        throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
    }
}

/**
 * Adds an event listener to a HTML element

View on GitHub (pinned to f37eb7ab38)

When it happens

Trigger: Thrown at wp-includes/js/clipboard.js:627 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of WordPress/WordPress@f37eb7ab38 (2026-08-17). Data as JSON: /api/errors/35f22308f8e89b3d. Report an issue: GitHub.