llms_update_util_rekey_meta( string $post_type, string $new_key, string $old_key )
Update the key of a postmeta item
Parameters Parameters
- $post_type
-
(string) (Required) Post type.
- $new_key
-
(string) (Required) New postmeta key.
- $old_key
-
(string) (Required) Old postmeta key.
Return Return
(void)
Source Source
File: includes/functions/llms.functions.updates.php
function llms_update_util_rekey_meta( $post_type, $new_key, $old_key ) { global $wpdb; $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}postmeta AS m INNER JOIN {$wpdb->prefix}posts AS p ON p.ID = m.post_ID SET m.meta_key = %s WHERE p.post_type = %s AND m.meta_key = %s;", array( $new_key, $post_type, $old_key ) ) ); // no-cache ok. }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.4.3 | Introduced. |