Modify wp-login.php content

Asked

Viewed 107 times

0

Hello, I’m creating a plugin that changes the layout of the Wordpress login screen (located on wp-login.php), but in addition to changing the page style (which I’ve already managed), I wanted to be able to add HTML elements in it, only without directly editing the wp-login.php.

Is there any way where I can redirect the reading of the original file to one that I created inside the plugin?

Thank you in advance.

  • 1

    It is more practical to find a plug-in that will do this for you than to try to do it manually...

  • @Pauloroberto yes, but at the moment I need to use this plugin own p/ apply on various sites during the year, without having to modify the wp-login.php every time I make this change. Most of the ready-made plugins come with many features and others I myself will add as my need. If you have any idea how I can do it, I appreciate the feedback.

  • You can use the Vqmod (not tested with WP) or create your login page: meu_login.php

2 answers

0

A "simple" way to do this is by redirecting the login to a custom page, and there you make the modifications you need.

Search in the Codex wp_login_form().

That one article can also give you a light

0

Another solution would be to use the functions.php of your Child to insert these elements dynamically. Example:

function my_custom_login() {
    echo '<script>

    document.addEventListener("DOMContentLoaded", function(event) {

    // Your code to run since DOM is loaded and ready
    document.getElementById(\'loginform\').insertAdjacentHTML(\'beforebegin\',
        \'<span class="asterisk">*</span>\');

    });

</script>';
}
add_action('login_head', 'my_custom_login');

Browser other questions tagged

You are not signed in. Login or sign up in order to post.