Would be great if anyone found a solution for this.
Exactly what i was looking for all day 🙂
This really should up highlighted somehow.
The URL does not change, the page refreshes (stays on the same URL) but the page becomes blank, without having any errors on it.
For some reason I can’t get this to work, The page is getting created, but I get redirected to a blank page, my current Front End page looks like:
<?php
$args = array(
'post_id' => 'new_1',
'field_groups' => array( 357 ),
'submit_value' => 'Submit Story',
'return' => '%post_url%?foo=bar'
);
acf_form( $args );
?>
And My Functions File:
//ACF FORM ARGUMENT
function my_pre_save_post( $post_id )
{
// check if this is to be a new post
if( $post_id != 'new_1' )
{
return $post_id;
}
// Create a new post
$post = array(
'post_status' => 'publish' ,
'post_title' => $_POST['fields']['field_54f5894e01b06'],
'post_content' => $_POST['fields']['field_54f5897401b07'],
'post_type' => 'shortstory',
'post_parent' => $_POST['fields']['field_54f596ac44e2b']
);
// insert the post
$post_id = wp_insert_post( $post );
// update $_POST['return']
$_POST['return'] = add_query_arg( array('post_id' => $post_id), $_POST['return'] );
return $post_id;
}
add_filter('acf/pre_save_post' , 'my_pre_save_post' );
Any help would be much appreciated.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.