質問編集履歴
1
追記 ●URKは以下のとおりです。ただ,登録してログインしないと入れないのですが http://www\.kenkou-recipes\.com/create-thread/make/ ●functi
test
CHANGED
File without changes
|
test
CHANGED
@@ -7,3 +7,103 @@
|
|
7
7
|
|
8
8
|
|
9
9
|
同じような事象が発生した方がいらっしゃいましたら。ご教示いただけると幸いです。
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
追記
|
16
|
+
|
17
|
+
●URKは以下のとおりです。ただ,登録してログインしないと入れないのですが
|
18
|
+
|
19
|
+
http://www.kenkou-recipes.com/create-thread/make/
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
●function.phpの概要は以下のとおりです。
|
26
|
+
|
27
|
+
```ここに言語を入力
|
28
|
+
|
29
|
+
function _my_create_note(){
|
30
|
+
|
31
|
+
global $create_thread_error;
|
32
|
+
|
33
|
+
if(
|
34
|
+
|
35
|
+
is_page('make')
|
36
|
+
|
37
|
+
&& is_user_logged_in()
|
38
|
+
|
39
|
+
&& isset($_POST['_wpnonce'])
|
40
|
+
|
41
|
+
&& wp_verify_nonce($_POST['_wpnonce'], 'create-thread-3')){
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
if(!isset($_POST['title']) || empty($_POST['title'])){
|
46
|
+
|
47
|
+
$create_thread_error[] = 'タイトルが空白です';
|
48
|
+
|
49
|
+
}
|
50
|
+
|
51
|
+
if(!isset($_POST['content']) || empty($_POST['content'])){
|
52
|
+
|
53
|
+
$create_thread_error[] = '本文が空です';
|
54
|
+
|
55
|
+
}
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
if(!isset($_POST["ninzuu"]) || empty($_POST["ninzuu"])){
|
60
|
+
|
61
|
+
$create_thread_error[] = '人数が空です';
|
62
|
+
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
if(empty($create_thread_error)){
|
68
|
+
|
69
|
+
$id = wp_insert_post(array(
|
70
|
+
|
71
|
+
'post_title' => (string)$_POST['title'],
|
72
|
+
|
73
|
+
'post_content' => (string)$_POST['content'],
|
74
|
+
|
75
|
+
'post_status' => 'draft',
|
76
|
+
|
77
|
+
//'post_status' => 'publish',
|
78
|
+
|
79
|
+
'post_date' => $_POST['Y-m-d'],
|
80
|
+
|
81
|
+
//'post_author' => $_POST['username'],
|
82
|
+
|
83
|
+
'post_author' => get_current_user_id(),
|
84
|
+
|
85
|
+
'post_type' => 'threads',
|
86
|
+
|
87
|
+
'page_template' => 'single-threads',
|
88
|
+
|
89
|
+
'post_category' => array(intval($_POST['cat']))
|
90
|
+
|
91
|
+
), true);
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
if(!is_wp_error($id)){
|
96
|
+
|
97
|
+
add_post_meta($id, 'rows', $_SESSION["rows"],false);
|
98
|
+
|
99
|
+
add_post_meta($id, 'ninzuu', $_POST["ninzuu"],false);
|
100
|
+
|
101
|
+
wp_insert_post($id);
|
102
|
+
|
103
|
+
```
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
●実際のエラーは以下のとおりとなります。
|
108
|
+
|
109
|
+
![イメージ説明](905c8d22cb204e2521574e9511528778.png)
|