coresocial-sharing-copy-success

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-success", link );
Arguments
Name
Type
Description
link
HTMLElement
Copy URL trigger element supplied by ClipboardJS; normally the button’s anchor.

JavaScript wp.hooks action after ClipboardJS reports a successful Copy URL operation and icon feedback is scheduled. Covers dynamically inserted Copy URL buttons. Independent of tracking success. It does not report AI prompt copying or confirm an external share.

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-success', 'my-site/clipboard', function ( link ) {
    console.log( 'URL copied', 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