| 1 |
<?php |
| 2 |
/** |
| 3 |
* Class LPYoastSeo |
| 4 |
* |
| 5 |
* Compatible with wordpress.org/plugins/wordpress-seo/ |
| 6 |
* @since 4.2.7.7 |
| 7 |
* @version 1.0.0 |
| 8 |
*/ |
| 9 |
namespace LearnPress\ExternalPlugin\RankMath; |
| 10 |
|
| 11 |
use LearnPress\Helpers\Singleton; |
| 12 |
use LearnPress\Models\CourseModel; |
| 13 |
use LP_Helper; |
| 14 |
use LP_Page_Controller; |
| 15 |
|
| 16 |
class LPRankMath { |
| 17 |
use Singleton; |
| 18 |
|
| 19 |
public function init() { |
| 20 |
add_filter( |
| 21 |
'rank_math/sitemap/exclude_post_type', |
| 22 |
[ $this, 'disable_link_sitemap_with_items_course' ], |
| 23 |
10, |
| 24 |
2 |
| 25 |
); |
| 26 |
} |
| 27 |
|
| 28 |
/** |
| 29 |
* Disable link sitemap with items course (lesson, quiz, question) |
| 30 |
* |
| 31 |
* @param $bool |
| 32 |
* @param $post_type |
| 33 |
* |
| 34 |
* @return bool |
| 35 |
*/ |
| 36 |
public function disable_link_sitemap_with_items_course( $bool, $post_type ) { |
| 37 |
$item_types = CourseModel::item_types_support(); |
| 38 |
$item_types[] = LP_QUESTION_CPT; |
| 39 |
if ( in_array( $post_type, $item_types ) ) { |
| 40 |
$bool = true; |
| 41 |
} |
| 42 |
|
| 43 |
return $bool; |
| 44 |
} |
| 45 |
} |
| 46 |
|