Last active
May 31, 2019 06:12
-
-
Save wpmudev-sls/6aaac87bedd770711fe1099d9ad23855 to your computer and use it in GitHub Desktop.
M2P WP Course Fix Issue Connect Lesson
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: M2P WP Course Fix Issue Connect Lesson | |
* Description: M2P WP Course Fix Issue Connect Lesson | |
* Author: Thobk @ WPMUDEV | |
* Author URI: https://premium.wpmudev.org/profile/tho2757 | |
* License: GPLv2 or later | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} | |
add_action( 'plugins_loaded', 'wpmudev_ms_wp_course_fix_issue_connect_lesson', 100 ); | |
function wpmudev_ms_wp_course_fix_issue_connect_lesson() { | |
if ( defined( 'MS_IS_PRO' ) && MS_IS_PRO && class_exists( 'MS_Rule_CptGroup' ) && class_exists('WPC_Courses') ) { | |
add_filter('pre_get_posts', 'wpmudev_wp_course_disable_protect_on_connect_lesson', 100); | |
function wpmudev_wp_course_disable_protect_on_connect_lesson( &$wp_query ){ | |
if( 'wpc-connected-lesson-to-course' === $wp_query->get('meta_key') && isset( $wp_query->query_vars['post__in'] ) ){ | |
unset( $wp_query->query_vars['post__in'] ); | |
} | |
return $wp_query; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment