Here is my hack to add content above the login form using the login_body_class
filter…
add_filter('login_body_class','login_body_hack',999);
function login_body_hack($classes) {
$classes[] = 'PLACEHOLDER';
add_filter('attribute_escape', 'login_body_filter_hack',999,2);
return $classes;
}
function login_body_filter_hack($safe_text, $text) {
// add whatever you like content here
$newcontent="<div id="contentwrapper">CONTENT</div>';
$replace="">"; // closes the body tag early
$replace .= $newcontent;
// some tag to be closed, as suffixed with the original ">
$replace .= '<img src="https://wordpress.stackexchange.com/questions/233457/javascript:void(0);" style="display:none;';
$safe_text = str_replace('PLACEHOLDER',$replace,$safe_text);
remove_filter('attribute_escape', 'login_body_filter_hack',999,2);
return $safe_text;
}
Note however that “as is” this will the content to all “login” pages (register, reset, lost password etc.) not just the login form one, so further checks would be needed to handle those cases.