php get_all_custom_field_meta问题

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php get_all_custom_field_meta问题相关的知识,希望对你有一定的参考价值。

{
    "key": "group_5a0cb501d0249",
    "title": "Location & Hours",
    "fields": [
        {
            "key": "field_5a0cb50f1fae4",
            "label": "Header Hours & Location info",
            "name": "header_hours",
            "type": "wysiwyg",
            "instructions": "",
            "required": 0,
            "conditional_logic": 0,
            "wrapper": {
                "width": "",
                "class": "",
                "id": ""
            },
            "default_value": "(631) 668-3377 | LOCATION | HOURS: Mon-Tues: 10-6; Wed-Thurs-Fri: 10-8; Sat: 10-5; Sun: 1-5",
            "tabs": "all",
            "toolbar": "basic",
            "media_upload": 0,
            "delay": 0
        }
    ],
    "location": [
        [
            {
                "param": "options_page",
                "operator": "==",
                "value": "acf-options-copyright-address"
            }
        ],
        [
            {
                "param": "page_template",
                "operator": "==",
                "value": "default"
            }
        ]
    ],
    "menu_order": 0,
    "position": "normal",
    "style": "default",
    "label_placement": "top",
    "instruction_placement": "label",
    "hide_on_screen": "",
    "active": 1,
    "description": "",
    "modified": 1510785689
}
<?php 
// FOR TESTING THIS CODE IS ON MY PAGE.PHP TEMPLATE

// These both correct return the value of the header_hours field, which is a WYSIWYG field with text in it
echo get_field('header_hours');
echo get_post_meta( get_the_ID(), 'header_hours', true );

// Value of hte header_hours field:
(631) 668-3377 | LOCATION | HOURS: Mon-Tues: 10-6; Wed-Thurs-Fri: 10-8; Sat: 10-5; Sun: 1-5

// See attached json for original file
$field_group_json = 'group_5a0cb501d0249.json';
$field_group_array = json_decode( file_get_contents( get_stylesheet_directory_uri() . '/acf-json/' . $field_group_json ), true );
$config = $field_group_array['fields'];
var_dump($config);

// Results of var_dump($config):
array (size=1)
  0 => 
    array (size=13)
      'key' => string 'field_5a0cb50f1fae4' (length=19)
      'label' => string 'Header Hours & Location info' (length=28)
      'name' => string 'header_hours' (length=12)
      'type' => string 'wysiwyg' (length=7)
      'instructions' => string '' (length=0)
      'required' => int 0
      'conditional_logic' => int 0
      'wrapper' => 
        array (size=3)
          'width' => string '' (length=0)
          'class' => string '' (length=0)
          'id' => string '' (length=0)
      'default_value' => string '(631) 668-3377 | LOCATION | HOURS: Mon-Tues: 10-6; Wed-Thurs-Fri: 10-8; Sat: 10-5; Sun: 1-5' (length=91)
      'tabs' => string 'all' (length=3)
      'toolbar' => string 'basic' (length=5)
      'media_upload' => int 0
      'delay' => int 0

// This is the line that results in the error (below):
$acf_option_values = get_all_custom_field_meta( get_the_ID(), $config);

// ERROR MESSAGE
Catchable fatal error: Argument 1 passed to TimJensen\ACF\Field_Group_Values::get_field_value() must be an instance of TimJensen\ACF\string, string given, 
called in C:\Users\Michelle\Documents\Websites\sitename.dev\wp-content\plugins\acf-field-group-values-master\src\Field_Group_Values.php on line 78 
and defined in C:\Users\Michelle\Documents\Websites\sitename.dev\wp-content\plugins\acf-field-group-values-master\src\Field_Group_Values.php on line 155

以上是关于php get_all_custom_field_meta问题的主要内容,如果未能解决你的问题,请参考以下文章

php PHP__YII__controller

php PHP __ $ _ SESSION - $ _ COKKIE

php php__newline.php

require(dirname(__FILE__).'/'.'myParent.php') 比 require('myParent.php') 有啥好处?

php PHP __ $ _ POST / $ _GET / $ _REQUEST

PHP的 __DIR__ 作用