Put the code on the on_pre_command {} block to prempt the per-location on_command {} handlers. Updated the documentation to put it in this block. You may need to press F5.