post_parent) ? get_post($post->post_parent) : $post; $field['value'] = str_replace('parent.', '', $field['value']); $value = $this->getCustomFieldsValues($post, $field); $field = $fieldBeforeReplacedValue; } else { if ($post->post_parent) { $parentValue = $this->getCustomFieldsValues(get_post($post->post_parent), $field); $variableValue = $this->getCustomFieldsValues($post, $field); if ( (!empty($parentValue) && empty($variableValue)) || (!empty($parentValue) && UserSettings::getOption("cfPriority", "product") === 'product') ) { $value = $parentValue; } else { $value = $variableValue; } } else { $value = $this->getCustomFieldsValues($post, $field); } } return $value; } }