Olivia Wilde and her former partner Jason Sudeikis have been granted a temporary restraining order from an alleged stalker.