diff --git a/projects/plugins/jetpack/changelog/update-likes-add-iframe-filter b/projects/plugins/jetpack/changelog/update-likes-add-iframe-filter new file mode 100644 index 0000000000000..60cf5daa19d06 --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-likes-add-iframe-filter @@ -0,0 +1,4 @@ +Significance: minor +Type: other + +Likes: Add a filter to the iframe url to enable future expansion and modularity. diff --git a/projects/plugins/jetpack/modules/likes.php b/projects/plugins/jetpack/modules/likes.php index fd3acc9c30b52..8e64974384773 100644 --- a/projects/plugins/jetpack/modules/likes.php +++ b/projects/plugins/jetpack/modules/likes.php @@ -448,6 +448,9 @@ function_exists( '\Activitypub\is_activitypub_request' ) $title = esc_html__( 'Like or Reblog', 'jetpack' ); + /** This filter is documented in modules/likes/jetpack-likes-master-iframe.php */ + $src = apply_filters( 'jetpack_likes_iframe_src', $src ); + $html = "
"; $html .= $headline; $html .= "
" . esc_html__( 'Like', 'jetpack' ) . ' ' . esc_html__( 'Loading...', 'jetpack' ) . '
'; diff --git a/projects/plugins/jetpack/modules/likes/jetpack-likes-master-iframe.php b/projects/plugins/jetpack/modules/likes/jetpack-likes-master-iframe.php index edf45e27d14e7..2d87782cec3dd 100644 --- a/projects/plugins/jetpack/modules/likes/jetpack-likes-master-iframe.php +++ b/projects/plugins/jetpack/modules/likes/jetpack-likes-master-iframe.php @@ -34,6 +34,17 @@ function jetpack_likes_master_iframe() { $new_layout ); + /** + * Filters the Likes iframe src, if any parameters need to be overridden or tracked. + * + * @module likes + * + * @since $$next-version$$ + * + * @param string URL to https://widgets.wp.com/ with various arguments appended to the get string and fragment. + */ + $src = apply_filters( 'jetpack_likes_iframe_src', $src ); + if ( $new_layout ) { // The span content is replaced by queuehandler when showOtherGravatars is called. $likers_text = wp_kses( '%d', array( 'span' => array() ) );