WordPress.org

Forums

Customizr
Invalid foreach argument on production server (2 posts)

  1. mica83
    Member
    Posted 8 months ago #

    Hi!
    I'm using customizr 3.1.21 on WordPress. I have this problem in production server:
    Warning: Invalid argument supplied for foreach() in ...\wp-content\themes\customizr\inc\class-fire-utils.php on line 676

  2. nikeo
    Member
    Theme Author

    Posted 8 months ago #

    Hi @mica83,
    The part of code you are referring to is the following :

    /**
         * Retrieves slider names and generate the select list
         * @package Customizr
         * @since Customizr 3.0.1
         */
        function tc_slider_choices() {
            $__options    =   get_option('tc_theme_options');
            $slider_names   =   isset($__options['tc_sliders']) ? $__options['tc_sliders'] : array();
    
          $slider_choices = array(
            0     =>  __( '— No slider —' , 'customizr' ),
            'demo'  =>  __( '— Demo Slider —' , 'customizr' )
            );
          if ( $slider_names ) {
            foreach( $slider_names as $tc_name => $slides) {
              $slider_choices[$tc_name] = $tc_name;
            }
          }
          return $slider_choices;
        }

    As you can see, the foreach construct loops on the $slider_names array. Your warning means that the $__options['tc_sliders'] var is set but not an array.
    Can you please describe what you did right before seeing this warning message?
    Thanks and I look forward to reading from you.

Reply

You must log in to post.

About this Theme

About this Topic

Tags

No tags yet.