Chuyển hướng login tới trang khóa học trong LearnPress WordPress

Đánh giá post

Chuyển hướng login xong tới trang các khóa học của khách hàng đã mua trong LearnPress WordPress

Thêm đoạn code sau vào file functions.php

function redirect_courses() {
if ( is_user_logged_in() ) {
$current_user = wp_get_current_user();
wp_redirect("/profile/" . $current_user->user_login . "/courses/purchased/" );
exit;
}
}

function redirect_courses_init(){
if ($_SERVER['REQUEST_URI'] == "/profile/") redirect_courses();
if (preg_match('"\\/profile\\/dashboard\\/.*"', $_SERVER['REQUEST_URI'])) redirect_courses();

}
add_action('init', 'redirect_courses_init');
Đánh giá post

Tags:



  1. First off I would like to say terrific blog!

    I had a quick question that I’d like to ask if you do not mind.
    I was curious to find out how you center yourself and
    clear your thoughts prior to writing. I’ve had trouble clearing
    my mind in getting my ideas out there. I
    do enjoy writing however it just seems like the first 10 to
    15 minutes are usually lost simply just trying to figure out how to begin. Any suggestions or hints?

    Thank you!

    Here is my blog post; http://new.stargardzki.stargard.pl

Trả lời

Email của bạn sẽ không được hiển thị công khai.