Abort generate_breadcrumblist_data is there are no crumbs

This commit is contained in:
Mike Jolley 2017-04-20 17:04:48 +01:00
parent 8cb1fa2aff
commit d5205b97f8
1 changed files with 4 additions and 0 deletions

View File

@ -287,6 +287,10 @@ class WC_Structured_Data {
public function generate_breadcrumblist_data( $breadcrumbs ) {
$crumbs = $breadcrumbs->get_breadcrumb();
if ( empty( $crumbs ) || ! is_array( $crumbs ) ) {
return;
}
$markup = array();
$markup['@type'] = 'BreadcrumbList';
$markup['itemListElement'] = array();