Invalid argument supplied for foreach()
-
Hi there!
Great plugin, I love it.However, I have encountered the following issue:
When the page pulls content through the plugin from a filed that has no input (data) in it the following warning shows up on the top of the page:
Warning: Invalid argument supplied for foreach() in /home/g290case/public_html/wp-content/plugins/acf-vc-integrator/acf-vc-integrator.php on line 97Lie 97 says: foreach ( $fields as $field ) {
foreach ( $groups as $group ) {
$flg = 1;$id = isset( $group[‘id’] ) ? ‘id’ : ( isset( $group[‘ID’] ) ? ‘ID’ : ‘id’ );
$groups_param_values[ $group[‘title’] ] = $group[ $id ];
$fields = function_exists( ‘acf_get_fields’ ) ? acf_get_fields( $group[ $id ] ) : apply_filters( ‘acf/field_group/get_fields’, array(), $group[ $id ] );
$fields_param_value = array();
foreach ( $fields as $field ) {
$fields_param_value[ $field[‘label’] ] = (string) $field[‘key’];
}Any solutions for this.
Is there a way to check if the filed has content and if there is no content to not return such warning.Thanks!
- The topic ‘Invalid argument supplied for foreach()’ is closed to new replies.