LearnDash_Permalinks::generate_rewrite_rules( array $wp_rewrite )
Setup custom rewrite URLs.
Contents
Description #
Important note: This is very much dependant on the order of the registered post types. This is import when WP goes to parse the request. See the logic in wp-includes/class-wp.php starting in the loop at line 289 where it loops the registered CPTs. Within this loop at line 311 it set the queried post_type with the last matched post_type per the parse/marched request. So if the Quiz CPT is registered before Topic then when we try to match the /courses/course-slug/lessons/lesson-slug/topics/topic-slug/quizzes/quiz-slug/ the queried ‘post_type’ will be set to topic not quiz. As a result in LD v2.5 in includes/class-ld-lms.php where we build the $post_args array we ensure the order of the to-be CPTs.
Parameters #
- $wp_rewrite
-
(array) (Required) Global WP rewrite array.