質問編集履歴
2
テストコードの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -19,6 +19,41 @@
|
|
19
19
|
](https://www.healing-solutions.jp/tech/4298/)
|
20
20
|
[https://private.hibou-web.com/archives/6226
|
21
21
|
](https://private.hibou-web.com/archives/6226)
|
22
|
+
|
23
|
+
### コード
|
24
|
+
上記のサイトを参考に試したコードは以下、
|
25
|
+
フィールドグループに登録されている「投稿オブジェクト」の値が取得できず。
|
26
|
+
```PHP
|
27
|
+
function get_acfe_field($field = null , $acf_id = null){
|
28
|
+
$acf_fields = get_post_custom( $acf_id );
|
29
|
+
if( is_array($acf_fields) ){
|
30
|
+
foreach( $acf_fields as $key=>$item ){
|
31
|
+
if(strpos($key,'field') !== false){
|
32
|
+
$item_value = unserialize($item[0]);
|
33
|
+
if( $item_value['name'] == $field ){
|
34
|
+
$acfe_fields[ $item_value['name'] ] = $item_value;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
return $acfe_fields[$field];
|
40
|
+
}
|
41
|
+
var_dump(get_acfe_field('target_field','1234'));
|
42
|
+
|
43
|
+
```
|
44
|
+
|
45
|
+
```php
|
46
|
+
add_action('restrict_manage_posts', 'add_subtitle_filter');
|
47
|
+
function add_subtitle_filter(){
|
48
|
+
global $post_type;
|
49
|
+
if ( $post_type == 'post' ) {
|
50
|
+
foreach (get_field('target_field') as $value) {
|
51
|
+
var_dump($value);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
};
|
55
|
+
```
|
56
|
+
|
22
57
|
### 補足情報(FW/ツールのバージョンなど)
|
23
58
|
|
24
59
|
WordPress ver4.9.9
|
1
リンクを設定
title
CHANGED
File without changes
|
body
CHANGED
@@ -13,10 +13,12 @@
|
|
13
13
|
### 試したこと
|
14
14
|
|
15
15
|
以下のサイトを参考に実装してみたが、動作せず。
|
16
|
-
https://nxpg.net/blog/?p=7467
|
16
|
+
[https://nxpg.net/blog/?p=7467
|
17
|
+
](https://nxpg.net/blog/?p=7467)
|
17
|
-
https://www.healing-solutions.jp/tech/4298/
|
18
|
+
[https://www.healing-solutions.jp/tech/4298/
|
19
|
+
](https://www.healing-solutions.jp/tech/4298/)
|
18
|
-
https://private.hibou-web.com/archives/6226
|
20
|
+
[https://private.hibou-web.com/archives/6226
|
19
|
-
|
21
|
+
](https://private.hibou-web.com/archives/6226)
|
20
22
|
### 補足情報(FW/ツールのバージョンなど)
|
21
23
|
|
22
24
|
WordPress ver4.9.9
|