WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp register

Description

This tag displays either the "Site Admin" link if the user is logged in or "Register" link if the user is not logged in.

The "Register" link is not offered if the Administration > Settings > General > Membership: Anyone can register box is not checked.

This tag does not function as intended on WordPress µ.

Usage

 <?php wp_register$before$after$echo ); ?> 

Parameters

$before
(string) (optional) Text to display before the Register or Site Admin link.
Default: '<li>'
$after
(string) (optional) Text to display after the Register or Site Admin link.
Default: '</li>'
$echo
(boolean) (optional) If true, echos the link, if false, returns the link as a string
Default: true

Examples

Default Usage

wp_register displays the link in list format <li>.

<?php wp_register(); ?>

Display Without Text Before or After

The following code example displays the "Register" or "Site Admin" link with no text in before or after parameters.

<?php wp_register('', ''); ?>

When not logged in the following HTML is produced:

<a href="http://www.example.com/wp-login.php?action=register">Register</a>

When logged in the following HTML is produced:

<a href="http://www.example.com/wp-admin/">Site Admin</a>

WordPress µ

On WordPress µ, there is no /wp-register.php file, and /wp-login.php?action=register is not a valid registration form. Thus, wp_register function does not show a registration link.

Notes

  • Uses: apply_filters() Calls 'register' hook on register / admin link content.

Change Log

Since: 1.5.0

Source File

wp_register() is located in wp-includes/general-template.php.

Related

Login Tags: is_user_logged_in(), wp_login_form(), wp_loginout(), wp_logout(), wp_register()
Login URLs: wp_login_url(), wp_logout_url(), wp_lostpassword_url(), wp_registration_url()

See also index of Function Reference and index of Template Tags.