Skip to content

Shortcodes

Job van Koeveringe edited this page Aug 20, 2026 · 2 revisions

Shortcodes

The plugin provides two public shortcodes. Add either one through the WordPress Shortcode block or directly in content that WordPress processes for shortcodes.

Shortcode Output
[scouting_oidc_button] A styled login button for signed-out visitors, or a logout button for signed-in visitors.
[scouting_oidc_link] A local OIDC login URL for signed-out visitors, or a WordPress logout URL for signed-in visitors.

When the OIDC client is not configured, the button shortcode is not rendered and the link shortcode returns a login error URL. When HTTPS is unavailable, the local login URL can still be rendered but fails safely when activated. The standard WordPress login form is unaffected.

Login button

Use the default button:

[scouting_oidc_button]

The button has these attributes:

Attribute Default Accepted value Notes
width 250 Number of pixels, minimum 120 When narrower than 225, the logo is hidden automatically.
height 40 Number of pixels, minimum 40 Keeps a usable click target.
background_color #4CAF50 Valid hexadecimal color Controls the button background.
text_color #ffffff Valid hexadecimal color Controls button text color.
hide_logo false Boolean-like value such as true, false, 1, or 0 Hides the logo when true.
redirect_back false Boolean-like value Sends the user back to the page containing the button after successful login.

Example:

[scouting_oidc_button width="280" height="44" background_color="#006b3f" text_color="#ffffff" redirect_back="true"]

Choose foreground and background colours with sufficient contrast. The shortcode does not validate the contrast of custom colours.

Login link

Use the link shortcode:

[scouting_oidc_link]

The link shortcode supports one attribute:

Attribute Default Effect
redirect_back false When true, returns the user to the current page after successful login.

Example:

[scouting_oidc_link redirect_back="true"]

Redirect back

redirect_back="true" includes the current page in the local OIDC login URL. After the visitor activates that URL, the plugin stores the value with the individual OIDC state. After the token and user data have been validated, the plugin uses that saved same-site URL instead of the general post-login redirect. The value is removed after use.

Use it for pages where a visitor should continue what they were doing after signing in, such as a members-only event page or a registration flow.

Placement guidance

  • Use the Shortcode block in the block editor so editors can see the shortcode clearly.
  • Put a clear visible label near the button when it appears in a context with multiple sign-in methods.
  • Do not copy the generated link destination from a rendered page. It is a local OIDC login URL; the plugin creates short-lived state and PKCE values only after that link is opened.
  • Use wp-login.php for administrator recovery. It retains the regular WordPress form as a fallback.

Clone this wiki locally