• Resolved Oscar-MR

    (@oscar-mr)


    To Daniel:

    Google Fonts doesn’t always return a font-subset or variant.
    To prevent the plugin to break, make sure to verify the array_merge function can be performed by checking if the array $font[‘variant’] $ $font[‘substes’] are set.
    The following code is a correction to prevent the breaking of this plug-in for certain fonts from Google:

    file: google_font_selector-v4.php

    line 92 onwards:

    if(!empty( $font['variants'] )) {
    				    $fontlist[$font['font']]['variants'] = array_merge( $fontlist[$font['font']]['variants'], $font['variants'] );
    }
    if(!empty( $font['subsets'] )) {
    				    $fontlist[$font['font']]['subsets'] = array_merge( $fontlist[$font['font']]['subsets'], $font['subsets'] );
    }

    Hope to have contributed accordingly!
    :))

    My best,

    Oscar

    https://wordpress.org/plugins/acf-google-font-selector-field/

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Checking for empty Arrays’ is closed to new replies.