Title: About pods create table
Last modified: August 16, 2023

---

# About pods create table

 *  Resolved [tera33](https://wordpress.org/support/users/tera33/)
 * (@tera33)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/about-pods-create-table/)
 * I learned that I can create my own tables using PODS. (What are Advanced Content
   Types).
 * I want to set it up from function.php or something like that, not from the admin
   panel.
 * I was able to create the table, but what do I do if I want to change the columns?
 * Also, if I set it from function.php, I want to make it impossible to change it
   from the admin screen.
 * (like pods_register_type).
 * This is my current code.
   Once created, the process is aborted because of an error.
 *     ```wp-block-code
       function create_custom_table_pod()
       {
       	$pod_name = 'my_custom_test';
   
       	$pod = pods_api()->load_pod(array('name' => $pod_name));
       	if ($pod) return;
   
   
       	$params = array(
       		'storage' => 'table', // カスタムテーブルストレージタイプを指定
       		'type' => 'pod', // コンテンツタイプ
       		'name' => $pod_name, // テーブル名
       		'label' => 'My Custom Table',
       		'public'         => '1',
       		'fields' => array(
       			array(
       				'name' => 'field_name',
       				'label' => 'Field Name',
       				'type' => 'text'
       			),
       			// 他のフィールドをここに追加
       		)
       	);
   
   
   
       	// Pod を作成
       	$pod = pods_api()->save_pod($params);
   
       	// Pod が正常に作成されたか確認
       	if (!is_wp_error($pod)) {
       		echo 'Pod created successfully with ID: ' . $pod;
       	} else {
       		echo 'Error creating Pod: ' . $pod->get_error_message();
       	}
   
       	// pods_register_type( $params['type'], $params['name'], $params );
       }
       add_action('init', 'create_custom_table_pod');
       ```
   
 * Also, it would be better if it could be used like the wp-mvc plugin.
 * [https://wpmvc.org/](https://wpmvc.org/)
 * My English is poor, so apologies if I’m rude.

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

 *  Plugin Support [pdclark](https://wordpress.org/support/users/pdclark/)
 * (@pdclark)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/about-pods-create-table/#post-16976056)
 * こんにちは [@tera33](https://wordpress.org/support/users/tera33/) さん、
 * [readme.txt](https://github.com/pods-framework/pods/blob/a20d6392eea3cc1fa181953e215cc1c262b15100/readme.txt#L431)
   に記載されている通り、`pods.json` ファイルはテーマに追加することができます。また、`
   pods_register_config_path()` または `pods_register_config_file()` でカスタムパス
   を登録することもできます。ディレクトリではなくファイルを登録する場合の詳細について
   は、[#4856](https://github.com/pods-framework/pods/pull/4856) を参照してください。
   サポートされているすべてのデータ形式について記載されています。
 * > JSON/YML ファイルを使用してテーマ内で Pods 設定を登録できます。これは `pods.
   > json`、`pods/pods.json`、`pods/templates.json` などに保存されています。また、
   > カスタムパスを登録してサードパーティのプラグインもサポートできます。`pods_register_config_path(
   > $full_directory_path )` を使用して `/pods/` ディレクトリを含む新しいパスを登録
   > し、自動的に取得します。また、`pods_register_config_file( $full_file_path, '
   > json' )` を使用して特定のファイルを登録できます。
 * `pods.json` ファイルは、`Pods Admin > Components > Import / Export Packages` 
   の管理画面からエクスポートできます。エクスポートでは、この目的のために選択され
   たフィールドまたはテンプレートのみが含まれる必要があります。これらは異なる .json
   ファイルに格納されています。
 * この方法でテーブル構造が設定されている場合、管理画面からは編集できなくなります。
 * Hi [@tera33](https://wordpress.org/support/users/tera33/),
 * As noted [in readme.txt](https://github.com/pods-framework/pods/blob/a20d6392eea3cc1fa181953e215cc1c262b15100/readme.txt#L431),
   a `pods.json` file can be added to the theme or a custom path registered with`
   pods_register_config_path()` or `pods_register_config_file()`. See [#4856](https://github.com/pods-framework/pods/pull/4856)
   for more details if registering a directory rather than a file, for all the data
   formats supported.
 * > Register Pods configurations with JSON/YML files in your theme when stored 
   > in `pods.json`, `pods/pods.json`, `pods/templates.json`, etc. Custom paths 
   > can be registered to support third party plugins as well. Register new paths
   > using `pods_register_config_path( $full_directory_path )` that contain a `/
   > pods/` directory to automatically pull from or use `pods_register_config_file(
   > $full_file_path, 'json' )` to register a specific file.
 * A `pods.json` file can be exported from the admin under `Pods Admin > Components
   > Import / Export Packages`. An export should have only fields or templates selected
   for this purpose, as these are stored in different `.json` files.
 * If table structure is set using this method, it will no longer be editable from
   the admin screen.
 *  Thread Starter [tera33](https://wordpress.org/support/users/tera33/)
 * (@tera33)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/about-pods-create-table/#post-16976946)
 * [@pdclark](https://wordpress.org/support/users/pdclark/)
 * Thank you in Japanese.
   Success.

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

The topic ‘About pods create table’ is closed to new replies.

 * ![](https://ps.w.org/pods/assets/icon.svg?rev=3286397)
 * [Pods - Custom Content Types and Fields](https://wordpress.org/plugins/pods/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pods/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pods/)
 * [Active Topics](https://wordpress.org/support/plugin/pods/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pods/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pods/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [tera33](https://wordpress.org/support/users/tera33/)
 * Last activity: [2 years, 10 months ago](https://wordpress.org/support/topic/about-pods-create-table/#post-16976946)
 * Status: resolved