You appear to be a bot. Output may be restricted
Description
Clone the post identified by the "payload" and/or "target" fields in the AJAX body- The payload is in JSON format.
- We need to strip slashes before it can be converted back into an object.
- The mapping is in JSON format.
Usage
$ID = oik_clone_lazy_clone_post();
Parameters
Returns
ID the target ID of the post created/updated… if it worked.Source
File name: oik-clone/admin/oik-clone-clone.phpLines:
1 to 29 of 29
function oik_clone_lazy_clone_post() { $payload = bw_array_get( $_REQUEST, "payload", null ); $target_id = oik_clone_get_target_id(); bw_trace2( $payload, "payload", false ); if ( $payload ) { $payload = stripslashes( $payload ); $post = json_decode( $payload, false ); bw_trace2( $post, "post", false ); if ( is_object( $post ) ) { $source_id = $post->ID; //p( "Updating post $id" ); // We need to load the target to make sure this is what we're supposed to be updating // $target_id = oik_clone_attempt_import( $source_id, $target_id, $post ); } else { p( "Payload is not an object" ); } } else { p( "Missing payload" ); } return( $target_id ); }View on GitHub