Hello, i'm getting this error on PHP log:
PHP Warning: Invalid argument supplied for foreach() in /wp-content/plugins/seo-by-rank-math/includes/class-replace-vars.php on line 876
This is what that line says:
// Custom Fields.
$json = array();
$custom_fields = get_post_custom( $post->ID );
876 foreach ( $custom_fields as $custom_field_name => $custom_field ) {
if ( substr( $custom_field_name, 0, 1 ) === '_' ) {
continue;
}
$json[ $custom_field_name ] = $custom_field[0];
}
Helper::add_json( 'customFields', $json );
}
PHP version is 7.2
How to fix it?