/** * Get post meta * * @param string $key Meta key. Required. * @param int|null $post_id Post ID. null for current post. Optional * @param array $args Array of arguments. Optional. * * @return mixed */ function rwmb_meta($key, $args = array(), $post_id = null) { /** * If meta boxes is registered in the backend only, we can't get field's params * This is for backward compatibility with version < 4.8.0 */ if (false === RWMB_Helper::find_field($key)) { return apply_filters('rwmb_meta', RWMB_Helper::meta($key, $args, $post_id)); } $args = wp_parse_args($args, array('type' => 'text')); $meta = in_array($args['type'], array('oembed', 'map')) ? rwmb_the_value($key, $args, $post_id, false) : rwmb_get_value($key, $args, $post_id); return apply_filters('rwmb_meta', $meta, $key, $args, $post_id); }
function cruxstore_meta($key, $args = array(), $post_id = null) { if (function_exists('rwmb_meta')) { /** * If meta boxes is registered in the backend only, we can't get field's params * This is for backward compatibility with version < 4.8.0 */ $field = RWMB_Helper::find_field($key); if (false === $field || isset($args['type'])) { return apply_filters('rwmb_meta', RWMB_Helper::meta($key, $args, $post_id)); } $meta = in_array($field['type'], array('oembed', 'map')) ? rwmb_the_value($key, $args, $post_id, false) : rwmb_get_value($key, $args, $post_id); return apply_filters('rwmb_meta', $meta, $key, $args, $post_id); } else { return null; } }
/** * Get post meta * * @param string $key Meta key. Required. * @param int|null $post_id Post ID. null for current post. Optional * @param array $args Array of arguments. Optional. * * @return mixed */ function rwmb_meta($key, $args = array(), $post_id = null) { $args = wp_parse_args($args); /* * If meta boxes is registered in the backend only, we can't get field's params * This is for backward compatibility with version < 4.8.0 */ $field = RWMB_Helper::find_field($key, $post_id); /* * If field is not found, which can caused by registering meta boxes for the backend only or conditional registration * Then fallback to the old method to retrieve meta (which uses get_post_meta() as the latest fallback) */ if (false === $field) { return apply_filters('rwmb_meta', RWMB_Helper::meta($key, $args, $post_id)); } $meta = in_array($field['type'], array('oembed', 'map')) ? rwmb_the_value($key, $args, $post_id, false) : rwmb_get_value($key, $args, $post_id); return apply_filters('rwmb_meta', $meta, $key, $args, $post_id); }