Advertisements

wp_register

Definition:
function wp_register( $before = '<li>', $after = '</li>', $echo = true ) {}

Display the Registration or Admin link.
Display a link which allows the user to navigate to the registration page if not logged in and registration is enabled or to the dashboard if logged in.

Parameters

  • string $before: Text to output before the link (defaults to <li>).
  • string $after: Text to output after the link (defaults to </li>).
  • boolean $echo: Default to echo and not return the link.

Defined filters

  • register
    apply_filters('register', $link)
  • register
    apply_filters('register', $link)

Source code

function wp_register( $before = '<li>', $after = '</li>', $echo = true ) {



	if ( ! is_user_logged_in() ) {

		if ( get_option('users_can_register') )

			$link = $before . '<a href="' . site_url('wp-login.php?action=register', 'login') . '">' . __('Register') . '</a>' . $after;

		else

			$link = '';

	} else {

		$link = $before . '<a href="' . admin_url() . '">' . __('Site Admin') . '</a>' . $after;

	}



	if ( $echo )

		echo apply_filters('register', $link);

	else

		return apply_filters('register', $link);

}

4019

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: