remove_yoast_schema_for_specific_pages

add_filter( ‘wpseo_json_ld_output’, ‘remove_yoast_schema_for_specific_pages’ );
function remove_yoast_schema_for_specific_pages( $data ) {
// List of Post/Page IDs where Yoast Schema should be disabled
$disabled_ids = array( 168225, 167878, 170550, 170528, 169910, 169614, 169070, 151686, 85338, 139360, 79148, 94368,7990,108459,171189,171238,171276,171687,100853,84872);

// Check if the current view is a single Post OR a Page with an ID in our list
if ( is_single( $disabled_ids ) || is_page( $disabled_ids ) ) {
// Return an empty array to disable schema for this item only
return array();
}

// For all other items, return the original Yoast schema data
return $data;
}

Scroll to Top
Solution lamp for mobile header

Custom Solutions with Zeevou

Discover tailored solutions perfectly suited to your role, business size, and specific use cases.