Add "Sign in with Microsoft" button anywhere (shortcode)

Use this guide if you want to add a "Sign in with Microsoft" button to any page or post of your WordPress website (or possibly to the header / footer area).

Before you start

  • You must already have configured the single sign-on capability of the WordPress + Office 365 plugin.
  • You are at least an Author for your WordPress website.

Using the shortcode

You can customize the shortcode as illustrated with the following example.

From this example it follows that the redirection to the Microsoft login URL is invoked by calling window.wpo365.pintraRedirect.toMsOnline(). The shortcode will ensure that the necessary javascript library is loaded beforehand. It’s up to you to change the enclosing HTML template, but please note that any JavaScript tags will be filtered out.

SAML 2.0

Administrators who have configured SAML 2.0 can use the previous example to create a custom button to include a domain hint that translates to an additional whr parameter as follows.

window.wpo365.pintraRedirect.toMsOnline('', '', '');
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us