質問編集履歴
2
DB未保存のカスタムフィールドの値の取得結果を追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,3 +1,83 @@
|
|
1
|
+
###追記2
|
2
|
+
|
3
|
+
DB未保存のカスタムフィールドの値を取得するのに、
|
4
|
+
|
5
|
+
$_POST["fields"]["フィールドキー"](フィールドキーは$_POST["fields"]をvar_dumpすると取れます)を使うことが分かりました。これを使えば投稿の新規作成時でもカスタムフィールドの値が取れます。
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
しかし、これを使うと、下記のように全ての値が
|
10
|
+
|
11
|
+
新規作成時の投稿のカスタムフィールドのものと同じになってしまいます。
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
```
|
16
|
+
|
17
|
+
array(2) {
|
18
|
+
|
19
|
+
["field_5a50f527cbddc"]=>
|
20
|
+
|
21
|
+
string(3) "yes"
|
22
|
+
|
23
|
+
["field_5a52618c69f7f"]=>
|
24
|
+
|
25
|
+
string(0) ""
|
26
|
+
|
27
|
+
}
|
28
|
+
|
29
|
+
array(2) {
|
30
|
+
|
31
|
+
["field_5a50f527cbddc"]=>
|
32
|
+
|
33
|
+
string(3) "yes"
|
34
|
+
|
35
|
+
["field_5a52618c69f7f"]=>
|
36
|
+
|
37
|
+
string(0) ""
|
38
|
+
|
39
|
+
}
|
40
|
+
|
41
|
+
array(2) {
|
42
|
+
|
43
|
+
["field_5a50f527cbddc"]=>
|
44
|
+
|
45
|
+
string(3) "yes"
|
46
|
+
|
47
|
+
["field_5a52618c69f7f"]=>
|
48
|
+
|
49
|
+
string(0) ""
|
50
|
+
|
51
|
+
}
|
52
|
+
|
53
|
+
array(2) {
|
54
|
+
|
55
|
+
["field_5a50f527cbddc"]=>
|
56
|
+
|
57
|
+
string(3) "yes"
|
58
|
+
|
59
|
+
["field_5a52618c69f7f"]=>
|
60
|
+
|
61
|
+
string(0) ""
|
62
|
+
|
63
|
+
}
|
64
|
+
|
65
|
+
array(2) {
|
66
|
+
|
67
|
+
["field_5a50f527cbddc"]=>
|
68
|
+
|
69
|
+
string(3) "yes"
|
70
|
+
|
71
|
+
["field_5a52618c69f7f"]=>
|
72
|
+
|
73
|
+
string(0) ""
|
74
|
+
|
75
|
+
}
|
76
|
+
|
77
|
+
```
|
78
|
+
|
79
|
+
|
80
|
+
|
1
81
|
###追記
|
2
82
|
|
3
83
|
mizさんに教えていただきましたこちらのページ(そのページに載ってたリンクも含む)を見て、
|
1
カスタムフィールドの値の取得タイミングに関しての記述を追加しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
###追記
|
2
|
+
|
3
|
+
mizさんに教えていただきましたこちらのページ(そのページに載ってたリンクも含む)を見て、
|
4
|
+
|
5
|
+
カスタムフィールドの値を取得するタイミングとアクションを起こすタイミングが上手くいっていないということまでは分かりました。
|
6
|
+
|
7
|
+
(そこからが分かりません..)
|
8
|
+
|
9
|
+
■ACF | acf/save_post
|
10
|
+
|
11
|
+
[https://www.advancedcustomfields.com/resources/acf-save_post/](https://www.advancedcustomfields.com/resources/acf-save_post/)
|
12
|
+
|
13
|
+
■Why isn't acf/save_post firing? - ACF Support
|
14
|
+
|
15
|
+
[https://support.advancedcustomfields.com/forums/topic/why-isnt-acfsave_post-firing/](https://support.advancedcustomfields.com/forums/topic/why-isnt-acfsave_post-firing/)
|
16
|
+
|
1
17
|
###前提・実現したいこと
|
2
18
|
|
3
19
|
WordPressで投稿を新規作成したタイミング(投稿を更新したりしたタイミングも含む)で、
|