Support

Account

Forum Replies Created

  • Hey John, I was able to solve this by moving the ajax save completely into my own function. Here is the function in case anyone finds this later:

    $('.acf-form').on('submit', function(e){
            e.preventDefault();
    		
    		// define the form data
    		let $form = $(e.target);
    		
    		// submit the form
    		$.ajax({
    			url: window.location.href,
    			method: 'post',
    			data: $form.serialize(),
    			success: function(data) {
    					$("a.save").removeClass("saveActive");
    					$("a.save").addClass("saveComplete");
    					$("a.save i").removeClass('fa-spinner');
    					$("a.save i").addClass('fa-thumbs-up');
    					$("#saveText").html("Saved");
    					
    					setTimeout(function(){
    						$("a.save").removeClass("saveComplete");
    						$("a.save i").removeClass('fa-thumbs-up');
    						$("a.save i").addClass('fa-save');
    						$("#saveText").html("Save");
    					}, 3000);	
    			}
    		});
    		console.log("form submit 1");
    	});

    I don’t know why it stopped working. Something about the e.preventDefault() stopping this:

    acf.add_action('submit', function($form){
    		
        // old ajax code was in here
    		
    	});
  • John, I know this thread has been dead for a bit but I have a question about the code snippet above- is there any way to force the post_status to future? I tried adding

    'post_status' => 'future',

    to the wp_update_post array but it still publishes the post on the date specified in the ACF field. I have been trying to figure out how to schedule a post with ACF for two weeks now and this is the closest I have gotten. Any help would be appreciated.

  • This worked like a charm. Feel free to delete this thread if you want.

Viewing 3 posts - 1 through 3 (of 3 total)