WordPress.org

Forums

Redirect not working going to $pid (1 post)

  1. Pete
    Member
    Posted 2 years ago #

    I'm using a form to create posts, some of the code is below with the redirect. This is not redirecting to the newly created post it's only refreshing the page with the form on it. Whats wrong with the redirect?

    $pid = wp_insert_post($new_post);
    
    update_post_meta($pid,'domain',$domain);
    update_post_meta($pid,'keywords',$keywords);
    
    wp_redirect( get_permalink($pid) );
    exit();

Topic Closed

This topic has been closed to new replies.

About this Topic