Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(isset($_REQUEST['vid']) ){
- $id=$_REQUEST['vid'];
- $post_title = 'sasa';
- $post_content ='zxczxczxc';
- $new_post = array(
- 'ID' => '',
- 'post_author' => $user->ID,
- 'post_content' => $post_content,
- 'post_title' => $post_title,
- 'post_status' => 'publish',
- // NOW IT'S ALREADY AN ARRAY
- );
- $post_id = wp_insert_post($new_post);
- // This will redirect you to the newly created post
- $post = get_post($post_id);
- $url=$post->guid;
- wp_redirect($post->guid);
- }
- //..... code as in question
- $post_id = wp_insert_post($new_post);
- $url = get_permalink( $post_id );
- wp_redirect($url);
- exit();
- <?php
- /**
- * .. Template comments
- */
- get_header();
- if(...) {
- ...
- if(...) {
- ...
- wp_redirect($url);
- exit();
- }
- }
- ?>
- <?php
- /**
- * .. Template comments
- */
- if(...) {
- ...
- if(...) {
- ...
- wp_redirect($url);
- exit();
- }
- }
- get_header();
- ?>
- wp_redirect( get_permalink( $post_id ) );
- exit(); // always exit
- $url = 'http://example.com';
- wp_redirect($url);
- exit();
- wp_redirect(get_permalink($post->ID));
- exit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement