Skip to content

Instantly share code, notes, and snippets.

@ihslimn
Created April 24, 2024 17:43
Show Gist options
  • Save ihslimn/057e75e92f27a963bf0f9f2f197cdfab to your computer and use it in GitHub Desktop.
Save ihslimn/057e75e92f27a963bf0f9f2f197cdfab to your computer and use it in GitHub Desktop.
JetReviews Remove emails from structured data
<?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