Moved an action hook and renamed the hook to be in the WP style

The action hook isn't reliably set when in a function so it is pulled out to always be hit. This was what WP recommended themselves. Also, I needed to rename the hook.