示例#1
0
 /**
  * Remove the `_tablepress_export_table_id` post meta field from the fields that are imported during a WP WXR import.
  *
  * @since 1.5.0
  *
  * @param array $postmeta Post meta fields for the post.
  * @param int   $post_id  Post ID.
  * @param array $post     Post.
  * @return array Modified post meta fields.
  */
 public function prevent_table_id_post_meta_import_on_wp_import(array $postmeta, $post_id, array $post)
 {
     // Bail if the post is not a TablePress table.
     if ($this->model_post->get_post_type() !== $post['post_type']) {
         return $postmeta;
     }
     // Remove the `_tablepress_export_table_id` post meta field from the post meta fields.
     foreach ($postmeta as $index => $meta) {
         if ('_tablepress_export_table_id' === $meta['key']) {
             unset($postmeta[$index]);
         }
     }
     return $postmeta;
 }