Preview Changes – save_post hook not firing every time
-
Hello everyone,
I have issue I’ve been struggling few days already and couldn’t find a problem so I hope someone has an idea.
We have our own page builder for all our buyers so they can build pages easily. Problem I encounter is that when user adds new element to page builder grid and try to preview the results, hook “save_post” doesn’t fire. Actually it fires every second time.
I search all over the web and my conclusion is:
– when user clicks on Preview Changes, WordPress store post Revision
– Hook “save_post” will fire only when there are changes in WordPress editor. Because user is adding content through page builder and nothing actually changes in WP Editor those changes are not detected.I tried changing tinyMCE “isDirty” parameter on two different ways when user adds content to page builder:
tinyMCE.activeEditor.setDirty(true); tinyMCE.activeEditor.isNotDirty = false;
Neither is working.
I assumed that changing this parameter when user adds new element to page builder will force firing save_post hook every time but unfortunately it doesn’t.
I also tried to track “save_post” hook in WordPress core files to find how and when it fires but this ended without results.
I think that page builder is not important at all in this case as I actually need (probably) to simulate change in WP Editor to force save_hook to fire.
I am out of ideas so I would appreciate if someone has idea how to resolve this.
Thank you,
Vladimir
- The topic ‘Preview Changes – save_post hook not firing every time’ is closed to new replies.