changes hook plugins_loaded to wp_json_server_before_serve. Issue: http://wordpress.org/support/topic/extending-wp_json_customposttype-gives