Home › Forums › Backend Issues (wp-admin) › Conflict with Themify Builder: Posts not saved anymore › Reply To: Conflict with Themify Builder: Posts not saved anymore
Hi guys,
I’ve just done some debugging and found some interesting info.
If possible, can you put me in contact with the theme developer as I would like to work together to find a compatibility for the issue.
Bellow is a snippet of code from the file themify.builder.admin.ui.js
:
if( $('#themify_builder_row_wrapper').is(':visible') ){
var self = ThemifyPageBuilder,
_this = $(this);
if( !self.isPostSave ){
self.saveData(false, function(){
self.isPostSave = true;
$('input#publish').trigger('click');
});
e.preventDefault();
}
else{
self.isPostSave = false;
return true;
}
}
This is run when the publish button is clicked. All works well, except for the ‘else’ statement. The ‘else’ statement is setting isPostSave
back to false, which prevents ACF from submitting the form after it validates the data.
This is what happens:
1. Click save
2. Themify saves data via JS and prevents the event from continuing (if)
3. Themify triggers click on the submit button when JS save is complete
4. ACF then performs it’s own JS validation in a similar way
5. Themify is triggered again and sets it’s isPostSave variable to false (else)
5. ACF triggers a click on the submit button when validation is complete
6. Themify JS triggers again and prevents the event from continuing (if).
To fix the issue, I believe the themify JS should not change isPostSave to false during the else statement. I suggest changing the code to:
if( $('#themify_builder_row_wrapper').is(':visible') ){
var self = ThemifyPageBuilder,
_this = $(this);
if( !self.isPostSave ){
self.saveData(false, function(){
self.isPostSave = true;
$('input#publish').trigger('click');
});
e.preventDefault();
}
else{
return true;
}
}
This allows themify to save data only once, and then allow any other JS to work as normal.
Let me know what you hear back from the dev (please pass on the above comment to them).
Thanks
E
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.