Skip to content

Commit

Permalink
MU WPCOM: Disable the Open Graph Tags according to the privacy of the…
Browse files Browse the repository at this point in the history
… site (#39012)

* MU WPCOM: Disable the Open Graph Tags according to the privacy of the site

* changelog

* Fix lint

* Fix typo

* Remove Jetpack OG only when the feature is enabled

* Fix Jetpack OG

* Fix lint

* Remove OG tags only when the site is configured to Coming Soon

* Update comment

* Add filter to turn of Jetpack Open Graph Tags

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10663051692

Upstream-Ref: Automattic/jetpack@368bf10
  • Loading branch information
arthur791004 authored and matticbot committed Sep 2, 2024
1 parent 8f49b6c commit 2d057bf
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 85 deletions.
58 changes: 29 additions & 29 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/automattic/jetpack-mu-wpcom/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
This is an alpha version! The changes listed here are not final.

### Changed
- MU WPCOM: Disable the Open Graph Tags according to the privacy of the site
- Point "Edit Profile" to profile.php when Site-Level Profile is enabled

## [5.60.0] - 2024-08-30
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,24 @@ function robots_txt( string $output, $public ): string {
}

add_filter( 'robots_txt', __NAMESPACE__ . '\\robots_txt', 12, 2 );

/**
* Disable the Open Graph Tags based on the value of either wpcom_public_coming_soon option.
*/
function remove_og_tags() {
if ( ! (bool) get_option( 'wpcom_public_coming_soon' ) ) {
return;
}

// Disable Jetpack Open Graph Tags.
add_filter( 'jetpack_enable_open_graph', '__return_false', 99 );

// Disable Yoast SEO. See https://developer.yoast.com/customization/yoast-seo/disabling-yoast-seo/.
if ( function_exists( 'YoastSEO' ) && class_exists( 'Yoast\WP\SEO\Integrations\Front_End_Integration', false ) ) {
// @phan-suppress-next-line PhanUndeclaredFunction, PhanUndeclaredClassReference
$front_end = \YoastSEO()->classes->get( \Yoast\WP\SEO\Integrations\Front_End_Integration::class );
remove_action( 'wpseo_head', array( $front_end, 'present_head' ), -9999 );
}
}

add_action( 'wp_head', __NAMESPACE__ . '\remove_og_tags', 0 );
Loading

0 comments on commit 2d057bf

Please sign in to comment.