Пример #1
0
 /**
  * Transform to get the WP and ACF fields of the sub post.
  *
  * @param array $field The field.
  * @return array
  */
 public static function transform_sub_post_fields(&$field)
 {
     if (is_array($field['value'])) {
         $data = [];
         foreach ($field['value'] as $post_id) {
             $data[] = Acf::get_post_field($post_id);
         }
         $field['value'] = $data;
     } else {
         $field['value'] = Acf::get_post_field($field['value']);
     }
 }
Пример #2
0
 /**
  * Get all ACF fields for the post.
  *
  * @param array 		   $object     The current object.
  * @param string 		   $field_name The field name.
  * @param \WP_REST_Request $request    The request.
  * @return array
  */
 public static function get_post_fields($object, $field_name, $request)
 {
     return Acf::get_post_field($object['id'], false);
 }