Support

Account

Home Forums ACF PRO post_title issue remains after 5.4.2 AJAX loading acf_form Reply To: post_title issue remains after 5.4.2 AJAX loading acf_form

  • I did some more testing – I’ve deactivated all other plugins and had the same results. I then stripped down my AJAX call to the bare minimum and ran it in a single-site WP v4.6 install (separate website, running a bare-bones theme, ACF v5.4.4, no other plugins) – same issue as above

    Here’s the relevant PHP & JS:

    
    // in functions.php
    add_action( 'wp_enqueue_scripts', 'add_scripts_styles' );
    function add_scripts_styles() {
    	$reqScripts = array('jquery');
    	wp_enqueue_script( 'cmsAJAX', get_template_directory_uri() . '/js/script.js', $reqScripts, '1.0' );
    	wp_localize_script( 'cmsAJAX', 'myAjax', array( 'ajaxurl' => admin_url('admin-ajax.php')) );
    }
    
    add_action("wp_ajax_test_cms_form", "test_cms_form");
    function test_cms_form() {
    	echo "In AJAX";
    	acf_form( array('post_id'=>14,'post_title'=>true) );
    	die();
    }
    
    // in script.js
    (function($){
    $(document).ready( function(){
    	do_test_form_ajax();
    });
    function do_test_form_ajax(){
    	
    	var data = {
    		'action'		: 'test_cms_form'
    	};
    	$.ajax({
    		type		: "post",
    		dataType	: "html",
    		url			: myAjax.ajaxurl,
    		data		: data,
    		success	: function(response) {
    			$( 'body' ).show().append( response );
    		},
    		error	: function(xhr, ajaxOptions, thrownError) {
    			$( 'body' ).append( "AJAX error" );
    		}
    	});
    	return false;
    }
    })(jQuery);
    

    Here again, the post_title field displays with no name, id, class, or placeholder attributes set. Specifically the attribute words show up in the Inspector, they just has no value (see prior post code).

    Any ideas?