Skip to content

Commit

Permalink
[not verified] Hide sharing buttons in Blog Posts block in the editor (
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekn authored and coder-karen committed Aug 2, 2022
1 parent 9816a9c commit b3b1455
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: bugfix

Sharing buttons are now hidden in Blog Posts block in editor
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,12 @@ function sharing_display( $text = '', $echo = false ) {
return $text;
}

// Prevent from rendering sharing buttons in block which is fetched from REST endpoint by editor
if ( defined( 'REST_REQUEST' ) && REST_REQUEST &&
isset( $_GET['context'] ) && 'edit' === $_GET['context'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
return $text;
}

// Don't output flair on excerpts.
if ( in_array( 'get_the_excerpt', (array) $wp_current_filter, true ) ) {
return $text;
Expand Down

0 comments on commit b3b1455

Please sign in to comment.