You are using esc_attr()
, which isn’t available if you use define( 'SHORTINIT', true );
, see source. So you either have to load the formatting.php
manually or have to ditch the define( 'SHORTINIT', true );
– actually like the example in the thread you are referring to shows.
As said in the comment, I checked out mentally after the first function that can’t work, but you are right about do_action
– can’t tell you exactly though what you need for that. Anyway, you should probably just not use SHORTINIT
and won’t have problems. Just to note as much, personally I just do my AJAX tasks the WordPress way.