Support

Account

Home Forums Front-end Issues ACF redirect after the publication of a new page Reply To: ACF redirect after the publication of a new page

  • Hi @buylov

    Something like this maybe?

    function my_pre_save_post( $post_id ) {
        if( get_post_type($post_id) == 'page' ){
            $GLOBALS['acf_form']['return'] = add_query_arg( array(
                'vc_action' => 'vc_inline',
                'post_id' => $post_id,
                'post_type' => 'page',
            ), 'http://mysite.com/wp-admin/post.php');
        }
    
        // return the new ID
        return $post_id;
    }
    
    add_filter('acf/pre_save_post' , 'my_pre_save_post', 10, 1 );

    Don’t forget to set 'post_type' => 'page', in your acf_form() function.

    Hope this helps.