Add custom content to nonexistent page

In your first example, you add the rewrite tag personal-development, but then you use the rewrite tag class_type inside your rewrite rule. That method would work if you fixed that error, and assuming 17318 is the page id of your personal-development page. You could then use get_query_var(‘personal_development’) in the template or a template hook, to … Read more

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

force download a file in template_redirect hook

The solution is in fact very simple. Just use the action admin_post_(action)… add_action( ‘admin_post_export_page’, ‘export_page’ ); function export_page() { // any code you want } than you can make custom links admin_url( ‘admin-post.php?action=export_page&id=’ . $post->ID ); Thanks Milo for giving the solution.