/** * Hijacks saving of cached oEmbed. * Saves cached data to relevant object metadata (vs postmeta) * * @since 0.9.5 * @param boolean $check Whether to continue setting postmeta * @param int $object_id Object ID to get postmeta from * @param string $meta_key Postmeta's key * @param mixed $meta_value Value of the postmeta to be saved * @return boolean Whether to continue setting */ public static function hijack_oembed_cache_set($check, $object_id, $meta_key, $meta_value) { if (!self::$hijack || self::$object_id != $object_id && 1987645321 !== $object_id) { return $check; } // Cache the result to our metadata if ('options-page' === self::$object_type) { // Set the option cmb_Meta_Box::update_option(self::$object_id, self::$embed_args['cache_key'], $meta_value, array('type' => 'oembed')); // Save the option cmb_Meta_Box::save_option(self::$object_id); } else { update_metadata(self::$object_type, self::$object_id, $meta_key, $meta_value); } // Anything other than `null` to cancel saving to postmeta return true; }
/** * Saves the cached oEmbed value to relevant object metadata (vs postmeta) * * @since 1.3.0 * @param string $meta_key Postmeta's key * @param mixed $meta_value Value of the postmeta to be saved */ public static function oembed_cache_set($meta_key, $meta_value) { // Cache the result to our metadata if ('options-page' === self::$object_type) { // Set the option cmb_Meta_Box::update_option(self::$object_id, self::$embed_args['cache_key'], $meta_value, array('type' => 'oembed')); // Save the option cmb_Meta_Box::save_option(self::$object_id); } else { update_metadata(self::$object_type, self::$object_id, $meta_key, $meta_value); } }