title: Advice on Error: Array to string conversion. Wordpress
body: <p>I have looked for a solution to this error. I would just like some advice as I think it's something small that I'm missing.</p>
  
  <p>I'm trying to get a url field and image field, using flexible content, from an options page set up with ACF pro. I'm getting the data, but not as a string variable.</p>
  
  <p>Here's a screenshot of the error.
  NEW LINK <a href="http://redrocketwebsitedesign.co.uk/Array_error2.png" rel="nofollow">http://redrocketwebsitedesign.co.uk/Array_error2.png</a></p>
  
  <p>And the code that generates this.</p>
  
  <pre><code>    &lt;ul class="list-inline"&gt;&lt;li&gt;
      &lt;p&gt;Follow us on&lt;/p&gt;
    &lt;/li&gt;
    &lt;?php //Options: Social icons
  
  // check if the flexible content field has rows of data
  if( have_rows('social_icon', 'option') ):
  
       // loop through the rows of data
      while ( have_rows('social_icon', 'option') ) : the_row();
  
          if( get_row_layout() == 'social_icon' ):
  
  
  $image = get_sub_field_object('social_image', 'option');
  
  if( $image ){
  ?&gt;
  
  
  &lt;li&gt;
  &lt;a href="&lt;?php echo the_sub_field('social_link', 'option'); ?&gt;" target="_blank"&gt;
  &lt;img class="img img-responsive" src="&lt;?php echo $image[7]; ?&gt;" alt="&lt;?php echo $image[alt]; ?&gt;"/&gt;
  &lt;/a&gt; 
  &lt;?php var_dump('Vardump &lt;br /&gt;') ?&gt;
  &lt;?php var_dump($url) ?&gt;
  &lt;?php var_dump('&lt;br /&gt; Image array &lt;br /&gt;') ?&gt;
  &lt;?php var_dump($image) ?&gt;
  &lt;?php var_dump('&lt;br /&gt; Image link &lt;br /&gt;') ?&gt;
  &lt;?php var_dump($image['7']) ?&gt;
  &lt;/li&gt;
  
  &lt;?php 
  }
  
  endif;
  
      endwhile;
      else :
  
      // no layouts found
  
  endif;
  
    ?&gt;
  
  
  &lt;/ul&gt;
  </code></pre>
  
  <p>Any help would be greatly appreciated :-]</p>
  
  <p>$social_image is the $field_name, and is stored as an image array. When I print_r $image, this is the result.I think I'm close to being able to pick the right string from the array.</p>
  
  <pre><code>    Image array
  
  `" array(22) { ["ID"]=&gt; int(138) ["key"]=&gt; string(19) "field_54e47a9b7f735" ["label"]=&gt; string(12) "Social Image" ["name"]=&gt; string(12) "social_image" ["prefix"]=&gt; string(0) "" ["type"]=&gt; string(5) "image" ["value"]=&gt; array(18) { ["ID"]=&gt; int(105) ["id"]=&gt; int(105) ["title"]=&gt; string(11) "Tripadvisor" ["filename"]=&gt; string(24) "footertripadvisorNEW.png" ["url"]=&gt; string(83) "http-link" ["alt"]=&gt; string(11) "Tripadvisor" ["author"]=&gt; string(1) "1" ["description"]=&gt; string(0) "" ["caption"]=&gt; string(0) "" ["name"]=&gt; string(20) "footertripadvisornew" ["date"]=&gt; string(19) "2015-02-10 16:13:27" ["modified"]=&gt; string(19) "2015-02-18 11:52:15" ["mime_type"]=&gt; string(9) "image/png" ["type"]=&gt; string(5) "image" ["icon"]=&gt; string(68) "http://localhost:8888/wordpress/wp-includes/images/media/default.png" ["width"]=&gt; int(50) ["height"]=&gt; int(50) ["sizes"]=&gt;`
  </code></pre>
  
  <p>..etc. </p>