Disable BreadcrumbList Schema

Need help with this?
Purchase All in One SEO Pack Pro to get dedicated support from us.

Buy Now

All in One SEO v3.4 added Schema.org structured data markup for Breadcrumbs (https://developers.google.com/search/docs/data-types/breadcrumb).  Some users may wish to disable this if their theme or another plugin already outputs this Schema markup.

The filter code below will disable only the BreadcrumbList Schema markup:

function prefix_schema_remove_breadcrumb( $layout ) {
     $array_key = array_search( '[aioseop_schema_BreadcrumbList]', $layout['@graph'] );
     if ( $array_key ) {
          unset( $layout['@graph'][ $array_key ] );
          $graphs_types = array(
               'WebPage',
               'CollectionPage',
               'SearchResultsPage',
               'ProfilePage',
          );
          foreach ( $graphs_types as $graphs_type ) {
               add_filter( 'aioseop_schema_class_data_AIOSEOP_Graph_' . $graphs_type, function ( $data ) {
                    if ( $data['breadcrumb'] ) {
                         unset( $data['breadcrumb'] );
                    }
                    return $data;
               });
          }
     }
     return $layout;
}

add_filter( 'aioseop_schema_layout', 'prefix_schema_remove_breadcrumb' );

For instructions on how to use this code, please refer to our FAQ here.