Switch language
wpseek on Twitter


A WordPress-centric search engine for devs and theme authors




wp_register ›

wp_register ( $before = '
  • ', $after = '
  • ', $echo = true
    )
    Parameters: (3)
    • (string) $before Text to output before the link (defaults to <li>).
      Required: No
      Default: '
    • '
    • (string) $after Text to output after the link (defaults to </li>).
      Required: No
      Default: '
    • '
    • (boolean) $echo Default to echo and not return the link.
      Required: No
      Default: true
    Returns:
    • (string|null) String when retrieving, null when displaying.
    Defined at:
    Codex:



    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.

    Source

    function wp_register( $before = '<li>', $after = '</li>', $echo = true ) {
    
    	if ( ! is_user_logged_in() ) {
    		if ( get_option('users_can_register') )
    			$link = $before . '<a href="' . esc_url( wp_registration_url() ) . '">' . __('Register') . '</a>' . $after;
    		else
    			$link = '';
    	} else {
    		$link = $before . '<a href="' . admin_url() . '">' . __('Site Admin') . '</a>' . $after;
    	}
    
    	if ( $echo ) {
    		/**
    		 * Filter the HTML link to the Registration or Admin page.
    		 *
    		 * Users are sent to the admin page if logged-in, or the registration page
    		 * if enabled and logged-out.
    		 *
    		 * @since 1.5.0
    		 *
    		 * @param string $link The HTML code for the link to the Registration or Admin page.
    		 */
    		echo apply_filters( 'register', $link );
    	} else {
    		/** This filter is documented in wp-includes/general-template.php */
    		return apply_filters( 'register', $link );
    	}
    }

    Top Google Search Results

    More ...

    User Note(s)