LLMS_Post_Model::clone_post()
Clones the Post if the post is cloneable
Description Description
Return Return
(mixed) WP_Error or WP Post ID of the clone (new) post
Source Source
File: includes/abstracts/abstract.llms.post.model.php
public function clone_post() { // if post type doesnt support cloning don't proceed if ( ! $this->is_cloneable() ) { return; } $this->allowed_post_tags_set(); $generator = new LLMS_Generator( $this->toArray() ); $generator->set_generator( 'LifterLMS/Single' . ucwords( $this->model_post_type ) . 'Cloner' ); if ( ! $generator->is_error() ) { $generator->generate(); } $this->allowed_post_tags_unset(); $generated = $generator->get_generated_posts(); if ( isset( $generated[ $this->db_post_type ] ) ) { return $generated[ $this->db_post_type ][0]; } return new WP_Error( 'generator-error', __( 'An unknown error occurred during post cloning. Please try again.', 'lifterlms' ) ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.3.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: