我在wordpress的默认函数中添加了更多变量,我看到了这个错误。有什么建议吗?提前谢谢!!
add_action(\'new_to_pending\', \'custom_wp_new_user_notification_email\');
add_action(\'draft_to_pending\', \'custom_wp_new_user_notification_email\');
add_action(\'auto-draft_to_pending\', \'custom_wp_new_user_notification_email\');
add_action(\'init\', \'approve_post\');
function set_html_content_type() { return \'text/html\'; }
add_filter( \'wp_new_user_notification_email\', \'custom_wp_new_user_notification_email\', 10, 5 );
function custom_wp_new_user_notification_email(
$wp_new_user_notification_email, $user, $blogname, $post ) {
// get author of post
$author = new WP_User($post->post_author);
// create a key for security check and save as meta
$check = md5( $author->user_email . $post->ID );
update_post_meta( $post->ID, \'_approve_key\', $check);
// set the content for the email
// create an url vor verify link with some variables: key, post id, and email
$url = add_query_arg(
array(
\'email\'=>$author->user_email,
\'approve\'=>$post->ID),
site_url()
);
$check = md5( $author->user_email . $post->ID );
update_post_meta( $post->ID, \'_approve_key\', $check);
$key = get_password_reset_key( $user );
$headers .= \'Content-type: text/html; charset=utf-8\' . "\\r\\n";
$message = sprintf(__(\'Bienvenido,\')) . "\\r\\n\\r\\n";
$message = "Tu cuenta:
" . sprintf(__(\'%s\'), $user->user_email) . "
<br>
Para establecer la contraseña:
" . "\\r\\n\\r\\n";
$enlace1= "". network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), \'login\') . "\\r\\n" . "";
$message .=\'<a href= "\' . $url . \'" onclick="window.open("\' . $enlace1 . \'" , \\\'_blank\\\', \\\'width=600,height=350\\\');" >Crear Contraseña</a>\'. "\\r\\n";
$message .= "Saludos," . "\\r\\n";
$wp_new_user_notification_email[\'message\'] = $message;
return $wp_new_user_notification_email;
}
错误
错误:Uncaught ArgumentCounter错误:参数太少,无法运行custom\\u wp\\u new\\u user\\u notification\\u email(),传入了3个。。