Created
April 24, 2024 17:43
-
-
Save ihslimn/057e75e92f27a963bf0f9f2f197cdfab to your computer and use it in GitHub Desktop.
JetReviews Remove emails from structured data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Jet_Reviews_Rich_Snippets_Email_Remover { | |
private $remove_email = false; | |
public function __construct() { | |
add_action( 'elementor/frontend/widget/before_render', array( $this, 'set_remove_flag' ) ); | |
add_filter( 'jet-reviews/user-manager/raw-user-data', array( $this, 'remove_email' ) ); | |
} | |
public function remove_email( $data ) { | |
if ( $this->remove_email ) { | |
$data['mail'] = ''; | |
} | |
return $data; | |
} | |
public function set_remove_flag( $widget ) { | |
$this->remove_email = $widget->get_name() === 'jet-reviews-advanced'; | |
} | |
} | |
new Jet_Reviews_Rich_Snippets_Email_Remover(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment