Title: ACF: Table Fields after update broken
Last modified: January 3, 2017

---

# ACF: Table Fields after update broken

 *  [reyz1980](https://wordpress.org/support/users/kirill1982/)
 * (@kirill1982)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/acf-table-fields-after-update-broken/)
 * Hey there,
 * my acf table fields plugin is broken since I made updates on WordPress core (
   4.7), acf(4.4.11) and acf:table fields(1.1.13). It actually says on the frontpage:
 * > Notice: Trying to get property of non-object in /homepages/27/d559574883/htdocs/
   > dev/wp-content/themes/mondopazzo/frontpage.php on line 97
 * The output of every line in this table is showing up like this. Before this error
   message there is showing up another table which looks good but is not related
   to this post_id. Very weird.
 * I made the usual troubleshooting.
 * The code looks like this:
 *     ```
       <?php
       // The Query
       $the_query = new WP_Query('post_id=106');
       // The Loop
       if ( $the_query->have_posts() ) {
       	while ( $the_query->have_posts() ) {
       		$the_query->the_post();
       		$table = get_post_meta(get_the_ID(), 'speisekarte_tabelle', true);
       		$table = json_decode($table);
       		echo '<ul class="pplan">';
       		foreach($table->b AS $row => $key) { 
       			echo '<li><span>'.$key->{'0'}->c.'</span><div>'.$key->{'1'}->c.'</div></li>';
       		}
       		echo '</ul>';
       	}
       } else {
       	// no posts found
       }
       /* Restore original Post Data */
       wp_reset_postdata();
       ?>
       ```
   

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

 *  Thread Starter [reyz1980](https://wordpress.org/support/users/kirill1982/)
 * (@kirill1982)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/acf-table-fields-after-update-broken/#post-8613866)
 * ![screenshot of the described problem](https://i0.wp.com/dev.mondopazzo.de/wp-
   content/themes/mondopazzo/images/screen.png)
 *  Plugin Author [Johann Heyne](https://wordpress.org/support/users/jonua/)
 * (@jonua)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/acf-table-fields-after-update-broken/#post-8614138)
 * Hello,
 * whatever makes the different after the updates to trow that error, the problem
   may is the following. The error on line 97 perhaps is because `$key` in `$key-
   >{'0'}->c` is not an object. `$key` is an array. So the code should look like`
   $key[0]->c`.
 * Anyway…
 * It is much easier to code using `get_field()`…
 *     ```
       $table = get_field( 'speisekarte_tabelle' );
       echo '<ul class="pplan">';
           foreach( $table['body'] as $row => $key ) { 
               echo '<li><span>' . $key[0]['c'] . '</span><div>' . $key[1]['c'] . '</div></li>';
           }
       echo '</ul>';
       ```
   
 *  Thread Starter [reyz1980](https://wordpress.org/support/users/kirill1982/)
 * (@kirill1982)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/acf-table-fields-after-update-broken/#post-8614600)
 * Hey Johann,
 * as I had a closer view on that issue, I’m still having problems with it. It now
   shows up all tables I create. Do you have an idea how to solve it with `the_query`.
   Thanks for your help.
    -  This reply was modified 9 years, 5 months ago by [reyz1980](https://wordpress.org/support/users/kirill1982/).
 *  Plugin Author [Johann Heyne](https://wordpress.org/support/users/jonua/)
 * (@jonua)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/acf-table-fields-after-update-broken/#post-8614916)
 * To get a single post by ID with WP_Query…
    `$the_query = new WP_Query( array('
   p' => 106 ) );`
 * And without WP_Query…
 *     ```
       $post_id = 106;
       $table = get_field( 'speisekarte_tabelle', $post_id );
       echo '<ul class="pplan">';
           foreach( $table['body'] as $row => $key ) { 
               echo '<li><span>' . $key[0]['c'] . '</span><div>' . $key[1]['c'] . '</div></li>';
           }
       echo '</ul>';
       ```
   
 *  Plugin Author [Johann Heyne](https://wordpress.org/support/users/jonua/)
 * (@jonua)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/acf-table-fields-after-update-broken/#post-8614934)
 * Get a single post with WP_Query:
    [https://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters](https://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters)
 *  Plugin Author [Johann Heyne](https://wordpress.org/support/users/jonua/)
 * (@jonua)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/acf-table-fields-after-update-broken/#post-8614951)
 * The reason showing all tables is maybe, that your WP_Query parameter does not
   exist and is ignored. So WP_Query returns all posts by default.
 *  Thread Starter [reyz1980](https://wordpress.org/support/users/kirill1982/)
 * (@kirill1982)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/acf-table-fields-after-update-broken/#post-8617203)
 * Hey Johann,
 * thanks a lot. That has solved my problem.

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

The topic ‘ACF: Table Fields after update broken’ is closed to new replies.

 * ![](https://ps.w.org/advanced-custom-fields-table-field/assets/icon-256x256.png?
   rev=1962986)
 * [Table Field Add-on for ACF and SCF](https://wordpress.org/plugins/advanced-custom-fields-table-field/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-custom-fields-table-field/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-custom-fields-table-field/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-custom-fields-table-field/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-custom-fields-table-field/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-custom-fields-table-field/reviews/)

## Tags

 * [ACF](https://wordpress.org/support/topic-tag/acf/)

 * 7 replies
 * 2 participants
 * Last reply from: [reyz1980](https://wordpress.org/support/users/kirill1982/)
 * Last activity: [9 years, 5 months ago](https://wordpress.org/support/topic/acf-table-fields-after-update-broken/#post-8617203)
 * Status: not resolved