How to check if the user was redirected?

You can use wp_get_referer function to acheive your requirement. Below is the useful code snippet for you. function wdm_referer() { global $post; if( post type is child ) { $child_post_id = $post->ID; $parent_id = get_parent_course_id($child_post_id); // your custom function to get parent course id if( parent task is not completed ) { // a condition … Read more