私はカスタム投稿タイプga_reports
の投稿をデータベースに挿入しています。あなたは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 |
:私は次のような結果を得るため、次のクエリでは
。
それでも私は私のカスタムポストタイプの何に取得する:私はないブラウザのキャッシュをチェック
function createOrUpdateGaReports($ganalytics_settings, $wpgamail_options, $id) {
global $wpdb;
$current_user = wp_get_current_user();
$user_id = get_current_user_id();
# get $id of ga_reports post and modify it, update the ganalytics_settings of this post and use the main config only in the first instance
if(TRUE === get_post_status($id) ) {
//post exists
// Update post 37
$my_post = array(
'ID' => $id,
'post_title' => 'Report-' . $current_user->user_login . '-' . date("Y-m-d H:i:s"),
'post_content' => $current_user->user_email,
'post_type' => 'ga_reports',
);
// Update the post into the database
wp_update_post($my_post);
//update via acf
//$ganalytics_settings
$field_key = "field_57b53f5217e16";
update_field($field_key, $ganalytics_settings, $my_post['ID']);
//$wpgamail_options
$field_key = "field_5777cc1bdebdd";
update_field($field_key, $wpgamail_options, $my_post['ID']);
} else {
//post does not exist
$my_post = array(
'post_title' => 'Report-' . $current_user->user_login . '-' . date("Y-m-d H:i:s"),
'post_content' => $current_user->user_email,
'post_status' => 'draft',
'post_author' => $user_id,
'post_type' => 'ga_reports',
);
// Insert the post into the database
$my_post = wp_insert_post($my_post);
//update via acf
//$ganalytics_settings
$field_key = "field_57b53f5217e16";
update_field($field_key, $ganalytics_settings, $my_post);
//$wpgamail_options
$field_key = "field_5777cc1bdebdd";
update_field($field_key, $wpgamail_options, $my_post);
}
}
:
ga_report
の記事は次のように作成/更新されます問題。
まだ投稿は表示されません。理由は何ですか?
返信いただきありがとうございます。