coresocial-sharing-popup-ready

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-popup-ready", details, link );
coreSocial 4.0 — src/frontend/index.ts:125
Arguments
Name
Type
Description
details
object
Shared details object: action, network, item, item_id, url, title. item_id comes from the link dataset and is normally a string.
link
HTMLAnchorElement
Activated share/print/QR link.

JavaScript wp.hooks action fired immediately before window.open() for the shared frontend’s standard share action. Tracking has been initiated but is not awaited.

The callback receives details and the anchor. The popup is opened from link.href; changing details.url does not change that destination. This event does not confirm a completed share. Special provider/app handlers may bypass this popup path.

Register with wp.hooks.addAction(), not PHP add_action(). Load the listener with the wp-hooks script dependency before the relevant user interaction. The Source Code block uses its generic action template; the code example shows the actual JavaScript API.

Example

wp.hooks.addAction( 'coresocial-sharing-popup-ready', 'my-site/share-observer', function ( details, link ) {
    console.log( 'Opening share popup for', details.network );
} );
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