Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpmudev-sls/6aaac87bedd770711fe1099d9ad23855 to your computer and use it in GitHub Desktop.
Save wpmudev-sls/6aaac87bedd770711fe1099d9ad23855 to your computer and use it in GitHub Desktop.
M2P WP Course Fix Issue Connect Lesson
<?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