coresocial-sharing-copy-error

Developer Knowledge Level

This content is intended for WordPress developers, and it may require coding knowledge of WordPress, PHP, and JavaScript. Code examples provided here may contain errors or needs some additional coding. Make sure to test the code before using it on a live website!

JS
Action identifier (JavaScript)
do_action( "coresocial-sharing-copy-error", link );
Arguments
Name
Type
Description
link
HTMLElement
Copy URL trigger element supplied by ClipboardJS; normally the button’s anchor.

JavaScript wp.hooks action when ClipboardJS reports a Copy URL failure. Independent of tracking success. It does not report AI prompt copying or the absence of ClipboardJS itself.

Register with wp.hooks.addAction(), using a unique namespace. Enqueue the listener with wp-hooks and coresocial-main dependencies before the interaction. The Source Code block uses a generic action template; the example shows the JavaScript API. Keep listeners lightweight and handle their own errors.

Example

wp.hooks.addAction( 'coresocial-sharing-copy-error', 'my-site/clipboard', function ( link ) {
    console.log( 'Copy failed for', link.dataset.url );
} );
Rate this reference
0
0
2

You are not allowed to rate this post.

Leave a Comment

0
0
0
0
0
0
0
0
0