下面是我使用login_body_class 滤器
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="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;
}
但是请注意,“按原样”这将是所有“登录”页面的内容(注册、重置、丢失密码等),而不仅仅是登录表单一,因此需要进一步检查以处理这些情况。