llms_update_util_post_duplicator( int $id )
Duplicate a WP Post & all relate metadata.
Parameters Parameters
- $id
-
(int) (Required) WP Post ID.
Return Return
(int) WP Post ID of the new duplicate.
Source Source
File: includes/functions/llms.functions.updates.php
function llms_update_util_post_duplicator( $id ) { $copy = (array) get_post( $id ); unset( $copy['ID'] ); $new_id = wp_insert_post( $copy ); foreach ( get_post_custom( $id ) as $key => $values ) { foreach ( $values as $value ) { add_post_meta( $new_id, $key, maybe_unserialize( $value ) ); } } return $new_id; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.16.0 | Introduced. |