Skip to content

Commit aa71bd9

Browse files
authored
Merge pull request #487 from IanDelMar/patch-3
Check whether $args['items_wrap'] is set
2 parents 5d33676 + 29e1dd0 commit aa71bd9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

class-wp-bootstrap-navwalker.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,11 +391,12 @@ public static function fallback( $args ) {
391391
* @return array $args The altered nav instance arguments.
392392
*/
393393
public function add_schema_to_navbar_ul( $args ) {
394-
$wrap = $args['items_wrap'];
395-
if ( strpos( $wrap, 'SiteNavigationElement' ) === false ) {
396-
$args['items_wrap'] = preg_replace( '/(>).*>?\%3\$s/', ' itemscope itemtype="http://www.schema.org/SiteNavigationElement"$0', $wrap );
394+
if ( isset( $args['items_wrap'] ) ) {
395+
$wrap = $args['items_wrap'];
396+
if ( strpos( $wrap, 'SiteNavigationElement' ) === false ) {
397+
$args['items_wrap'] = preg_replace( '/(>).*>?\%3\$s/', ' itemscope itemtype="http://www.schema.org/SiteNavigationElement"$0', $wrap );
398+
}
397399
}
398-
399400
return $args;
400401
}
401402

0 commit comments

Comments
 (0)