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?
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.