Redirect new-form MP URLs (/mp/1234/name/constituency) to MP page with PID. Entire URL is also passed so the page can determine if canonical URL is used (and redirect if not).
Moved special case for Elizabeth II to beginning of function so it returns before anything else.
make_member_url() supports passing of Person ID to be used in generating the URL.
MP page now tests for PID first, and if not accessed via canonical URL for that PID will redirect to the canonical URL.
Moving braces and adding comments to make the code clearer.
Removing unnecessary $redirect and ->canonical functionality, as all non-canonical URLs are automatically redirected.
Cases where make_member_url() is called now pass through the PID to generate canonical URLs.
Tests for retrieving members and generating member URLs.