Skip to content

Commit

Permalink
Add hook to filter meta keys when duplicating courses
Browse files Browse the repository at this point in the history
  • Loading branch information
yscik committed Dec 8, 2020
1 parent ebff411 commit 2b4d2ed
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion includes/class-sensei-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,19 @@ private function duplicate_post( $post, $suffix = null, $ignore_course = false )
$post_meta = get_post_custom( $post->ID );
if ( $post_meta && count( $post_meta ) > 0 ) {

$ignore_meta = array( '_quiz_lesson', '_quiz_id', '_lesson_quiz', '_lesson_prerequisite' );
/**
* Ignored meta fields when duplicating a post.
*
* @hook sensei_duplicate_content_ignore_meta
* @since 3.7.0
*
* @param {array} $meta_keys The meta keys to be ignored.
* @param {WP_Post} $new_post The new duplicate post.
* @param {WP_Post} $post The original post that's being duplicated.
*
* @return {array} $meta_keys The meta keys to be ignored.
*/
$ignore_meta = apply_filters( 'sensei_duplicate_post_ignore_meta', [ '_quiz_lesson', '_quiz_id', '_lesson_quiz', '_lesson_prerequisite' ], $new_post, $post );

if ( $ignore_course ) {
$ignore_meta[] = '_lesson_course';
Expand Down

0 comments on commit 2b4d2ed

Please sign in to comment.