$post_id
-
Good afternoon, I have created a front-end form for logged in users to submit posts. Once the post is created they are redirected to a confirmation page, which is also on the front end, and this is where i have an issue. I want the newly created $post_id to be carried to this page where it will be inserted into a custom table along with other data. I have created a redirect function in my functions.php file.
function myFunction() { if ( wp_insert_post == true) { $postid = get_the_ID(); wp_redirect (home_url( '/custom_page/' )); } } add_action( 'save_post', 'myFunction' );
The redirect works but I just can’t populate my $postid. I have tried to echo it but it comes with nothing.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘$post_id’ is closed to new replies.