【メモ】WordPressで問合せフォームを作る ②データベース設定

Flamingoのデータベース確認

Contact Form 7 関連プラグイン

データ登録先

下記に登録されている。
テーブル:wp_posts
post_type:’flamingo_inbound’

確認SQL


select 
id,
post_author,
post_date,
post_date_gmt,
post_content,
post_title,
post_excerpt,
post_status,
comment_status,
ping_status,
post_password,
post_name,
to_ping,
pinged,
post_modified,
post_modified_gmt,
post_content_filtered,
post_parent,
guid,
menu_order,
post_type,
post_mime_type 
comment_count 
from wp_posts 
where post_type = 'flamingo_inbound' 
#where post_name = 'test-116'
\G;

実際に登録されているか確認する。

wp_posts 確認SQL


select * from wp_posts where post_name = 'test-116' \G;

mysql> select * from wp_posts where post_name = 'test-116' \G;
*************************** 1. row ***************************
                   ID: 8989
          post_author: 0
            post_date: 2021-09-11 21:39:42
        post_date_gmt: 2021-09-11 12:39:42
         post_content: (★ここが登録内容)
           post_title: test
         post_excerpt:
          post_status: publish
       comment_status: closed
          ping_status: closed
        post_password:
            post_name: test-116
              to_ping:
               pinged:
        post_modified: 2021-09-11 21:39:42
    post_modified_gmt: 2021-09-11 12:39:42
post_content_filtered:
          post_parent: 0
                 guid: /?post_type=flamingo_inbound&p=8989
           menu_order: 0
            post_type: flamingo_inbound
       post_mime_type:
        comment_count: 0
1 row in set (0.00 sec)

ERROR:
No query specified

post_id からmeta情報を確認する。

wp_postmeta 確認SQL


select meta_id, post_id, meta_key from wp_postmeta where post_id = 8990;

mysql> select meta_id, post_id, meta_key from wp_postmeta where post_id = 8990;
+---------+---------+------------------------+
| meta_id | post_id | meta_key               |
+---------+---------+------------------------+
|   79691 |    8990 | _form                  |
|   79692 |    8990 | _mail                  |
|   79693 |    8990 | _mail_2                |
|   79694 |    8990 | _messages              |
|   79695 |    8990 | _additional_settings   |
|   79696 |    8990 | _locale                |
|   79747 |    8990 | _config_errors         |
|   79748 |    8990 | _wp_cf7pdf             |
|   79749 |    8990 | _wp_cf7pdf_fields      |
|   79750 |    8990 | _wp_cf7pdf_fields_scan |

確認SQL


mysql -u root -p -h localhost wordpress -e "select * from wp_postmeta where post_id = 8990 and meta_key = '_form';"

★mysql -u root -p -h localhost wordpress -e "select id, post_name, post_content from wp_posts where post_type = 'flamingo_inbound';"

DBからFlamingoの登録データを取得している箇所のコード


./wp-content/plugins/flamingo/admin/admin.php
749    $post = new Flamingo_Inbound_Message( $post_id );

meta情報を確認

post_idで確認


select meta_id, post_id, meta_key from wp_postmeta where post_id = '9016';

 

post_idとmeta_keyで確認1


mysql> select meta_id, post_id, meta_key, meta_value from wp_postmeta where post_id = '9016' and meta_key = '_field_select1';
+---------+---------+----------------+----------------------+
| meta_id | post_id | meta_key       | meta_value           |
+---------+---------+----------------+----------------------+
|   79895 |    9016 | _field_select1 | a:1:{i:0;s:3:"有";}  |
+---------+---------+----------------+----------------------+
1 row in set (0.00 sec)

 

post_idとmeta_keyで確認2


mysql> select meta_id, post_id, meta_key, meta_value from wp_postmeta where post_id = '9016' and meta_key = '_field_mail';
+---------+---------+-------------+----------------+
| meta_id | post_id | meta_key    | meta_value     |
+---------+---------+-------------+----------------+
|   79878 |    9016 | _field_mail | admin@test.com |
+---------+---------+-------------+----------------+
1 row in set (0.00 sec)

 

post_idとmeta_keyで確認3


mysql> select meta_id, post_id, meta_key, meta_value from wp_postmeta where post_id = '9016' and meta_key = '_field_corp';
+---------+---------+-------------+-------------------------+
| meta_id | post_id | meta_key    | meta_value              |
+---------+---------+-------------+-------------------------+
|   79879 |    9016 | _field_corp | a:1:{i:0;s:6:"個人";}   |
+---------+---------+-------------+-------------------------+
1 row in set (0.00 sec)
タイトルとURLをコピーしました