coresocial-sharing-print

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-print", link );
coreSocial 4.0 — src/frontend/index.ts:145
Arguments
Name
Type
Description
link
HTMLAnchorElement
Activated share/print/QR link.

JavaScript wp.hooks action fired after the shared frontend calls window.print() for the printer button. The timing follows the browser’s print-dialog behavior.

This is not confirmation that a document was printed; the visitor can cancel the dialog. It does not provide a print result or a filtered value.

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-print', 'my-site/print-observer', function ( link ) {
    console.log( 'Print dialog requested.' );
} );
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