Support » Plugin: Content Control - User Access Restriction Plugin » Invalid argument supplied for foreach()

  • Resolved Elvin Huseynov

    (@azazello99)


    Hi there!

    I am getting such kind of error:

    PHP Warning: Invalid argument supplied for foreach() in .../wp-content/plugins/content-control/classes/Shortcodes.php on line 69

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author danieliser

    (@danieliser)

    @azazello99 – Sorry for the delay. I will add a check to prevent that but it means you didn’t add any conditions to your content_control shortcode.

    Hi,
    I had the same warning and I fixed it temporarly with a check before the foreach statment as follows:

    
    public static function normalize_empty_atts( $atts ) {
        if (is_array($atts) || is_object($atts))
        {
          foreach ( $atts as $attribute => $value ) {
            if ( is_int( $attribute ) ) {
              $atts[ strtolower( $value ) ] = true;
              unset( $atts[ $attribute ] );
            }
          }
        }
        return $atts;
    }
    

    Kind regards,
    Johan

    Abdul Samad

    (@abdul-samad-shaikh)

    Hi,

    I am getting an error. please help me out https://gtka.co.uk/faq

    Plugin Author danieliser

    (@danieliser)

    @abdul-samad-shaikh – are you getting this error, or even one related to this plugin? I didn’t see anything wrong when I visited the link you sent.

    If you have a different issue, best to start a new topic in the right place.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.