Title: Array Push expects parameter 1 to be an array
Last modified: November 20, 2019

---

# Array Push expects parameter 1 to be an array

 *  Resolved [ktrusak](https://wordpress.org/support/users/ktrusak/)
 * (@ktrusak)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/array-push-expects-parameter-1-to-be-an-array/)
 * I’m trying to set default values for a CPT when the post is created, however 
   when I try to use the provided code it won’t let me on an empty field. Is there
   a way to establish the field so I can push rows in?

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

 *  Plugin Author [Johann Heyne](https://wordpress.org/support/users/jonua/)
 * (@jonua)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/array-push-expects-parameter-1-to-be-an-array/#post-12188448)
 * Hi,
 * I’m not sure what you trying to do.
 * If you want to predefine a table when creating a new Custom Posts entry. Then
   you would have to create the data of a table in the database as post meta for
   the corresponding table field. To get the table data, you could create and save
   the table as desired in that custom post, copy the code from the post meta of
   that table field from the database and use it for your script to create a predefined
   table.
 * Or if you want the give a default table, if a table is empty…
 *     ```
       $table = get_field( 'your_table_field_name' );
   
       if ( empty ( $table ) ) {
   
           // defining the data of the default table
           $table = array(
               'header' => array(
                   'c' => 'Column 1',
               ),
               'body' => array(
                   array( // a column
                       array( // a cell of the column
                           'c' => 'Cell Value of Column 1', // the value of the cell
                       ),
                   ),
               ),
           );
   
           // output code follows…
           echo '<table border="0">';
           // and so on
       }
       ```
   
 * Cheers,
    Johann
 *  Thread Starter [ktrusak](https://wordpress.org/support/users/ktrusak/)
 * (@ktrusak)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/array-push-expects-parameter-1-to-be-an-array/#post-12190139)
 * Thank you!

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

The topic ‘Array Push expects parameter 1 to be an array’ 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/)

 * 2 replies
 * 2 participants
 * Last reply from: [ktrusak](https://wordpress.org/support/users/ktrusak/)
 * Last activity: [6 years, 6 months ago](https://wordpress.org/support/topic/array-push-expects-parameter-1-to-be-an-array/#post-12190139)
 * Status: resolved