0

The default Wordpress Login and Registration pages use the following markup for the page's top-level heading:

<h1><a href="<?php echo esc_url( $login_header_url ); ?>"><?php echo $login_header_text; ?></a></h1>

The link in the markup, if you changed the destination to your site homepage via login_headerurl, is both redundant because of the "← Go to Site Name" link at the bottom of the page and confusing because the redundant link "pollutes the link list on a screen reader" (Estela Rueda from Wordpress).

Removing the markup directly from the wp-login.php file is not recommended because editing core files is a no-no (GetFlyWheel). Using I could use a plugin, but I'd like to avoid all the cruft I possibly can and every user plugin I've seen is way overkill for me (as the built-in login system for Wordpress is plenty sufficient for my site besides this issue).

So that leaves PHP solutions. While the header URL and text can be altered via hooks (login_headerurl and login_headertitle respectively), there are no hooks or filters that can be used for removing the link markup entirely. PHP's ob_get_contents could have been an option if the markup was being echoed (which could be accomplished via wp_login_form) and was run in the same function as the echo (due to function scoping).

It's worth mentioning that this can be easily fixed via JavaScript, but I would rather not sacrifice accessibility for users who disable JavaScript (Amazon and Wikipedia can get along without it, and there is nothing on my site that would require JavaScript besides this).

Are there any other ways via PHP where this could be accomplished? Thanks in advance!

1 Answer 1

0

In the Customizing the Login Form page in the Wordpress Codex, I found the wp_login_form function, which can be put on a custom page where I can control the markup around the form, just as I need!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.