Skip to content

Commit

Permalink
Falling back on wp method if metadata not found by acf
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmuswinter committed Apr 27, 2017
1 parent d17a165 commit 84c6632
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions classes/ooPost.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,13 @@ public function metadata($name, $single = true) {
$meta = null;
if (function_exists('get_field')) {
$meta = get_field($name, $this->ID);
// if not found by acf, then may not be an acf-configured field, so fall back on normal wp method
if ($meta === false) {
$fieldObj = get_field_object($name, $this->ID);
if (!$fieldObj || !$fieldObj['key']) {
$meta = get_post_meta($this->ID, $name, $single);
}
}
} else {
$meta = get_post_meta($this->ID, $name, $single);
}
Expand Down

0 comments on commit 84c6632

Please sign in to comment.