Skip to content

Commit

Permalink
Allow meta handler to properly handle non-single meta
Browse files Browse the repository at this point in the history
  • Loading branch information
iansvo committed Dec 6, 2024
1 parent 64b8b19 commit 5a4f19f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion includes/class-meta-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,12 @@ public static function get_meta( $id, $key, $single_only = true, $callable = nul
);

if ( is_numeric( $id ) ) {
$meta = $pre_value ? $pre_value : call_user_func( $callable, $id, $parent_name, true );
$meta = $pre_value ? $pre_value : call_user_func( $callable, $id, $parent_name, $single_only );

// If it's an array with only one item, return it directly.
if ( is_array( $meta ) && 1 === count( $meta ) ) {
$meta = $meta[0];
}
} else {
$meta = $pre_value ? $pre_value : call_user_func( $callable, $parent_name );
}
Expand Down

0 comments on commit 5a4f19f

Please sign in to comment.