Title: Illegal string offset errors
Last modified: August 31, 2016

---

# Illegal string offset errors

 *  [ac2agency](https://wordpress.org/support/users/ac2agency/)
 * (@ac2agency)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/illegal-string-offset-errors-2/)
 * I get the following errors, and when I link my pages on facebook they are printed
   instead of the text in the page. What to do? Thanks in advance
    Please note that
   ac2-theme is my personalized theme
 * Warning: Illegal string offset ‘hide_thumbnail_on_single’ in /htdocs/public/www/
   wp-content/themes/ac2-theme/header.php on line 6 Warning: Illegal string offset‘
   columns’ in /htdocs/public/www/wp-content/themes/ac2-theme/header.php on line
   8

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [Mr Case](https://wordpress.org/support/users/mr-case/)
 * (@mr-case)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/illegal-string-offset-errors-2/#post-6944098)
 * what does your header.php file look like? can you share it on [**pastebin**](http://pastebin.com/)?
 *  Thread Starter [ac2agency](https://wordpress.org/support/users/ac2agency/)
 * (@ac2agency)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/illegal-string-offset-errors-2/#post-6944153)
 * can you see this? Click on the underlined text
 * thanks for your answer
    best
 *  [Mr Case](https://wordpress.org/support/users/mr-case/)
 * (@mr-case)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/illegal-string-offset-errors-2/#post-6944184)
 * i dont think that was your header.php file. that didnt even look like PHP. the
   error says there is a warning on a certain line of your header.php file. that
   is what we would have to look at
 *  Thread Starter [ac2agency](https://wordpress.org/support/users/ac2agency/)
 * (@ac2agency)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/illegal-string-offset-errors-2/#post-6944239)
 * try this instead?
    [http://pastebin.com/EnA5R6d3](http://pastebin.com/EnA5R6d3)
   thanks a million
 *  Thread Starter [ac2agency](https://wordpress.org/support/users/ac2agency/)
 * (@ac2agency)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/illegal-string-offset-errors-2/#post-6944240)
 * This second file proves that the error is in line 6 and 8 of the first file
    
   ie. the following highlighted in bold font
 *  if(is_single() || is_page()) { $post_or_page_id = $post->ID; }
    $data = get_post_meta(
   $post_or_page_id, “custom_meta_values”, true); if($data[“hide_thumbnail_on_single”])**
   $custom_settings[“layout”][“hide_thumbnail_on_single”] = $data[“hide_thumbnail_on_single”];**
   if($data[“columns”]) **$custom_settings[“layout”][“columns”] = $data[“columns”];**
 * but I don’t know I to solve this since I have not coded this and my web designer
   is no longer a web designer and unavailable
 *  [Mr Case](https://wordpress.org/support/users/mr-case/)
 * (@mr-case)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/illegal-string-offset-errors-2/#post-6944352)
 * try replacing that section with this:
 *     ```
       if (is_single() || is_page()) {
           $post_or_page_id = $post->ID;
       }
   
       $data = get_post_meta($post_or_page_id, "custom_meta_values", true);
   
       if ($data["hide_thumbnail_on_single"]) {
           $custom_settings["layout"]["hide_thumbnail_on_single"] = $data["hide_thumbnail_on_single"];
       }
   
       if ($data["columns"]) {
           $custom_settings["layout"]["columns"] = $data["columns"];
       }
       ```
   
 * it looked like some curly brackets were missing
 *  Thread Starter [ac2agency](https://wordpress.org/support/users/ac2agency/)
 * (@ac2agency)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/illegal-string-offset-errors-2/#post-6944394)
 * We corrected it, but now we get two errors
 * Warning: Illegal string offset ‘hide_thumbnail_on_single’ in /htdocs/public/www/
   wp-content/themes/ac2-theme/header.php on line 12 Warning: Illegal string offset‘
   columns’ in /htdocs/public/www/wp-content/themes/ac2-theme/header.php on line
   14
 * and
 * Warning: Illegal string offset ‘hide_thumbnail_on_single’ in /htdocs/public/www/
   wp-content/themes/ac2-theme/header.php on line 16 Warning: Illegal string offset‘
   columns’ in /htdocs/public/www/wp-content/themes/ac2-theme/header.php on line
   20
 * I pasted the index php file here <[http://pastebin.com/9XcMDMEW&gt](http://pastebin.com/9XcMDMEW&gt);
 * Thanks in advance!
 *  [Mr Case](https://wordpress.org/support/users/mr-case/)
 * (@mr-case)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/illegal-string-offset-errors-2/#post-6944405)
 * try using single quotes in ALL of your array elements and see if that helps.
   
   for example, change this:
 *     ```
       if ($data["columns"]) {
           $custom_settings["layout"]["columns"] = $data["columns"];
       }
       ```
   
 * to this:
 *     ```
       if ($data['columns']) {
           $custom_settings['layout']['columns'] = $data['columns'];
       }
       ```
   
 * The only other thing I can think of is that there isn’t an array or there aren’t
   any values set for it.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Illegal string offset errors’ is closed to new replies.

## Tags

 * [columns](https://wordpress.org/support/topic-tag/columns/)
 * [header](https://wordpress.org/support/topic-tag/header/)
 * [illegal string offset](https://wordpress.org/support/topic-tag/illegal-string-offset/)
 * [Themes](https://wordpress.org/support/topic-tag/themes/)

 * 8 replies
 * 2 participants
 * Last reply from: [Mr Case](https://wordpress.org/support/users/mr-case/)
 * Last activity: [10 years, 4 months ago](https://wordpress.org/support/topic/illegal-string-offset-errors-2/#post-6944405)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
