I am using the acf/fields/flexible_content/layout_title Filter, which works as i need it. except that when users enter apostrophes they get escaped. I am using htmlentities( )
so they are fine at first but eventually get escaped by JS.
after trying a few things it looks like the solution is to return stripslashes($title);
any attempts to encode or decode html get cancelled out by the fact that the next time the ajax_layout_title loop runs JS will sanitize it.
stripping right before returning let’s jQuery do whatever it wants with the string, cleaning up just before it is shown to the user.