cleverington / elegant

An OOP + ACF + Timber / TWIG based WordPress theme.
4 stars 0 forks source link

Clean the admin login page a bit to remove the wordpress.org redirect #11

Open cleverington opened 2 years ago

cleverington commented 2 years ago

These changes are pretty straightforward.

I would say WordPress.php, since that Class is focused on cleaning cruft.

/**
 * Add to existing run() function
 */
public function run() {
    add_filter( 'login_headerurl', array($this,'login_logo_url') );
    add_filter( 'login_headertext', array($this,'login_logo_url_title') );
}

/**
 * Reset - Login page 'home' URL on Logo
 *
 * This function resets the link URL of the header logo above the login form.
 * Changes the default from 'WordPress' to the site-homepage.
 *
 * @since 1.0.1
 * @see https://developer.wordpress.org/reference/hooks/login_headerurl/
 */
public static function login_logo_url() : void {
    return home_url();
}

/**
 * Reset - Header logo Link Text on Login page
 *
 * Filters the link text of the header logo above the login form on the login page.
 *
 * @since 0.1.1
 * @see https://developer.wordpress.org/reference/hooks/login_headertext/
 */
public static function login_logo_url_title() : void {
    return get_bloginfo( 'name' );
}