php - How to check that if current user (ID) has posts or not wordpress -
i have custom template. in want check if current logged in user has custom posts named (student_form) or not if posts equals true want redirect page other wise want show him/her form created using wp fronted user.
following code wrote not redirecting desired page if user has custom posts .
<?php /* * template name: form page */ get_header(); global $post,$current_user; get_currentuserinfo(); if ($post->post_author == $current_user->id) { exit( wp_redirect(http://myurl/dashboard/') ); } else { echo do_shortcode('[wpuf_form id="414"]'); } wp_reset_query(); // restore global post data stomped the_post(). get_footer(); ?>
Comments
Post a Comment