diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-data.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-data.php index cedd64d7..b8a47aeb 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-data.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-table-data.php @@ -19,11 +19,16 @@ class SP_Meta_Box_Table_Data { * Output the metabox */ public static function output( $post ) { - $table = new SP_League_Table( $post ); - list( $columns, $usecolumns, $data, $placeholders, $merged ) = $table->data( true ); - $adjustments = $table->adjustments; - $highlight = get_post_meta( $table->ID, 'sp_highlight', true ); - self::table( $table->ID, $columns, $usecolumns, $data, $placeholders, $adjustments, $highlight ); + global $pagenow; + if ( is_admin() && in_array( $pagenow, array( 'post-new.php' ) ) && 'sp_table' == get_post_type() ) { + self::table( ); + }else{ + $table = new SP_League_Table( $post ); + list( $columns, $usecolumns, $data, $placeholders, $merged ) = $table->data( true ); + $adjustments = $table->adjustments; + $highlight = get_post_meta( $table->ID, 'sp_highlight', true ); + self::table( $table->ID, $columns, $usecolumns, $data, $placeholders, $adjustments, $highlight ); + } } /** @@ -39,7 +44,7 @@ class SP_Meta_Box_Table_Data { /** * Admin edit table */ - public static function table( $id, $columns = array(), $usecolumns = null, $data = array(), $placeholders = array(), $adjustments = array(), $highlight = null, $readonly = false ) { + public static function table( $id = 0, $columns = array(), $usecolumns = null, $data = array(), $placeholders = array(), $adjustments = array(), $highlight = null, $readonly = false ) { if ( is_array( $usecolumns ) ) $usecolumns = array_filter( $usecolumns );