我正在将自定义帖子类型pow
的帖子插入数据库。
通过以下查询,我得到以下结果:
ga_reports
SELECT * FROM wp_posts p, wp_postmeta m WHERE p.post_status = 'draft' && m.post_id = p.ID
正如您所看到的,| ID | post_author | post_date | post_status | post_type | meta_id | post_id | meta_key | meta_value |
|-----|-------------|------------------|-------------|------------|---------|---------|---------------------------|------------------------------|
| 524 | 1 | 17.08.2016 20:26 | draft | ga_reports | 1610 | 524 | _ | |
| 524 | 1 | 17.08.2016 20:26 | draft | ga_reports | 1611 | 524 | ganalytics_settings | NULL |
| 524 | 1 | 17.08.2016 20:26 | draft | ga_reports | 1612 | 524 | _ganalytics_settings | field_5779133493ecc |
| 524 | 1 | 17.08.2016 20:26 | draft | ga_reports | 1613 | 524 | wpgamail_options | NULL |
| 524 | 1 | 17.08.2016 20:26 | draft | ga_reports | 1614 | 524 | _wpgamail_options | field_5777cc1bdebdd |
| 526 | 1 | 17.08.2016 21:04 | draft | ga_reports | 1619 | 526 | ganalytics_settings | a:7:{s:16:"google_auth_code" |
| 526 | 1 | 17.08.2016 21:04 | draft | ga_reports | 1620 | 526 | _ganalytics_settings | field_5779133493ecc |
| 526 | 1 | 17.08.2016 21:04 | draft | ga_reports | 1621 | 526 | wpgamail_options | NULL |
| 526 | 1 | 17.08.2016 21:04 | draft | ga_reports | 1622 | 526 | _wpgamail_options | field_5777cc1bdebdd |
| 527 | 1 | 17.08.2016 21:04 | draft | ga_reports | 1623 | 527 | ganalytics_settings | a:7:{s:16:"google_auth_code" |
| 527 | 1 | 17.08.2016 21:04 | draft | ga_reports | 1624 | 527 | _ganalytics_settings | field_5779133493ecc |
| 527 | 1 | 17.08.2016 21:04 | draft | ga_reports | 1625 | 527 | wpgamail_options | NULL |
| 527 | 1 | 17.08.2016 21:04 | draft | ga_reports | 1626 | 527 | _wpgamail_options | field_5777cc1bdebdd |
| 528 | 1 | 18.08.2016 04:42 | draft | ga_reports | 1628 | 528 | ganalytics_settings | a:6:{s:16:"google_auth_code" |
| 528 | 1 | 18.08.2016 04:42 | draft | ga_reports | 1629 | 528 | _ganalytics_settings | field_5779133493ecc |
| 528 | 1 | 18.08.2016 04:42 | draft | ga_reports | 1630 | 528 | wpgamail_options | |
| 528 | 1 | 18.08.2016 04:42 | draft | ga_reports | 1631 | 528 | _wpgamail_options | field_5777cc1bdebdd |
| 529 | 1 | 18.08.2016 04:42 | draft | ga_reports | 1632 | 529 | ganalytics_settings | a:7:{s:16:"google_auth_code" |
| 529 | 1 | 18.08.2016 04:42 | draft | ga_reports | 1633 | 529 | _ganalytics_settings | field_5779133493ecc |
| 529 | 1 | 18.08.2016 04:42 | draft | ga_reports | 1634 | 529 | wpgamail_options | |
| 529 | 1 | 18.08.2016 04:42 | draft | ga_reports | 1635 | 529 | _wpgamail_options | field_5777cc1bdebdd |
| 530 | 1 | 18.08.2016 04:42 | draft | ga_reports | 1636 | 530 | ganalytics_settings | a:7:{s:16:"google_auth_code" |
| 530 | 1 | 18.08.2016 04:42 | draft | ga_reports | 1637 | 530 | _ganalytics_settings | field_5779133493ecc |
| 530 | 1 | 18.08.2016 04:42 | draft | ga_reports | 1638 | 530 | wpgamail_options | |
| 530 | 1 | 18.08.2016 04:42 | draft | ga_reports | 1639 | 530 | _wpgamail_options | field_5777cc1bdebdd |
| 532 | 1 | 18.08.2016 05:00 | draft | ga_reports | 1643 | 532 | ganalytics_settings_copy | a:6:{s:16:"google_auth_code" |
| 532 | 1 | 18.08.2016 05:00 | draft | ga_reports | 1644 | 532 | _ganalytics_settings_copy | field_57b53f5217e16 |
| 532 | 1 | 18.08.2016 05:00 | draft | ga_reports | 1645 | 532 | wpgamail_options | NULL |
| 532 | 1 | 18.08.2016 05:00 | draft | ga_reports | 1646 | 532 | _wpgamail_options | field_5777cc1bdebdd |
| 533 | 1 | 18.08.2016 05:00 | draft | ga_reports | 1647 | 533 | ganalytics_settings_copy | a:7:{s:16:"google_auth_code" |
| 533 | 1 | 18.08.2016 05:00 | draft | ga_reports | 1648 | 533 | _ganalytics_settings_copy | field_57b53f5217e16 |
| 533 | 1 | 18.08.2016 05:00 | draft | ga_reports | 1649 | 533 | wpgamail_options | NULL |
| 533 | 1 | 18.08.2016 05:00 | draft | ga_reports | 1650 | 533 | _wpgamail_options | field_5777cc1bdebdd |
| 534 | 1 | 18.08.2016 05:01 | draft | ga_reports | 1651 | 534 | ganalytics_settings_copy | a:7:{s:16:"google_auth_code" |
| 534 | 1 | 18.08.2016 05:01 | draft | ga_reports | 1652 | 534 | _ganalytics_settings_copy | field_57b53f5217e16 |
| 534 | 1 | 18.08.2016 05:01 | draft | ga_reports | 1653 | 534 | wpgamail_options | NULL |
| 534 | 1 | 18.08.2016 05:01 | draft | ga_reports | 1654 | 534 | _wpgamail_options | field_5777cc1bdebdd |
应该有几个可用的草稿帖子。
我仍然在我的自定义帖子中输入任何内容:
以下列方式创建/更新 ga_reports
个帖子:
ga_report
我检查了浏览器缓存,这不是问题。
仍然没有显示帖子。有什么建议吗?
感谢您的回复!
答案 0 :(得分:0)
可以替换此代码
$ my_post = array( ' POST_TITLE' => '报告 - ' 。 $ current_user-> user_login。 ' - ' 。日期(" Y-m-d H:i:s"), ' POST_CONTENT' => $ current_user-> USER_EMAIL, ' post_status' => '草案&#39 ;, ' post_author' => $ USER_ID, ' post_type' => ' ga_reports&#39 ;, );
使用:
$ my_post = array( ' POST_TITLE' => '报告 - ' 。 $ current_user-> user_login。 ' - ' 。日期(" Y-m-d H:i:s"), ' POST_CONTENT' => $ current_user-> USER_EMAIL, ' post_status' => '发布&#39 ;, ' post_author' => $ USER_ID, ' post_type' => ' ga_reports&#39 ;, );