Moves the wp_footer action so it works properly with plugins