I want remove json-ld
website microdata, and I think I must disable action in the class WPSEO_JSON_LD
Action:
add_action( 'wpseo_json_ld', array( $this, 'website' ), 10 );
Changes in my functions.php
:
remove_action( 'wpseo_json_ld', array( 'WPSEO_JSON_LD', 'website' ), 10 );
What I am doing wrong?
Solution:
add_filter( 'wpseo_json_ld_output', 'swp_remove_jsonld_yoast', 10, 2 );
function swp_remove_jsonld_yoast($data, $context){
if($data['@type'] == 'WebSite'){
$data = false;
}
return $data;
}
You can better use a filter to clear the output by that function I think. There are filters for wpseo_json_ld_output.
I got it working by adding this snippet into my functions.php file