Seo for unit

Tagged: ,

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #252596
    StudioLeBus
    Participant
    Hello ! I have yoast installed and I added unit in search result so google can find the free units... but now google gives errors for unit that can not be accessed (that are not free)... Searching on the forum I found this code to redirect not free unit to course but it's not working. Maybe the code is too old ?? Tell me if it's possible to redirect unit to course if not logged in or something like that thanks !... https://wplms.io/support/forums/topic/seo-affected-due-to-units/ add_action('template_redirect',function(){ global $post; if( $post->post_type != 'unit' ) return; $unit_id = $post->ID; $user_id = get_current_user_id(); $course_id = bp_course_get_unit_course_id($unit_id); $check = bp_course_is_member($course_id); if( empty($course_id) ) return; if( empty($user_id) || empty($check) ){ wp_redirect( get_permalink( $course_id ) ); exit; } });
    #252598
    StudioLeBus
    Participant
    Ok forget it it's ok I mixed up things !
    #252689
    Diana
    Participant
    @StudiioLeBus, Okay then, closing
Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Seo for unit’ is closed to new replies.