URL パス 'wp-login.php?action=register' の外で登録フォームを取得すると、エラーが発生します
( ! ) SCREAM: Error suppression ignored for
( ! ) Fatal error: Call to undefined function register_new_user() in C:\wamp\www\mysite-t\wp-content\themes\mysite\functions\theme-access.php on line 74
Call Stack
# Time Memory Function Location
1 0.0003 676128 {main}( ) ..\index.php:0
2 0.0005 680960 require( 'C:\wamp\www\mysite-t\wp-blog-header.php' ) ..\index.php:17
3 0.0008 707056 require_once( 'C:\wamp\www\mysite-t\wp-load.php' ) ..\wp-blog-header.php:12
4 0.0011 725040 require_once( 'C:\wamp\www\mysite-t\wp-config.php' ) ..\wp-load.php:29
5 0.0019 858224 require_once( 'C:\wamp\www\mysite-t\wp-settings.php' ) ..\wp-config.php:90
6 1.2878 34464032 do_action( ) ..\wp-settings.php:308
7 1.3151 34734896 call_user_func_array ( ) ..\plugin.php:406
8 1.3151 34734928 edd_post_actions( ) ..\plugin.php:406
9 1.3151 34735016 do_action( ) ..\actions.php:40
10 1.3151 34736392 call_user_func_array ( ) ..\plugin.php:406
11 1.3151 34736424 forest_process_registre_form( ) ..\plugin.php:406
これが私のフォームです
<form id="registre_form" class="horizontal-form" action="" method="post">
<fieldset>
<div class="input-group">
<label for="user_login"><?php echo __( 'Username', 'forest' ); ?>:</label>
<div class="inputs">
<input name="user_login" id="user_login" class="required" type="text" value="<?php echo isset($_POST['user_login']) ? esc_attr(stripslashes($_POST['user_login'])):''; ?>"/>
</div>
</div>
<div class="input-group">
<label for="user_email"><?php echo __( 'E-mail Addy', 'forest' ); ?>:</label>
<div class="inputs">
<input name="user_email" id="user_email" class="required" type="text" value="<?php echo isset($_POST['user_email']) ? esc_attr(stripslashes($_POST['user_email'])):''; ?>"/>
</div>
</div>
<div class="input-group">
<div class="inputs">
<em><?php echo __( 'The password will be e-mailed to you.', 'forest' ); ?></em>
</div>
</div>
<div class="form-submit">
<input type="hidden" name="edd_redirect" value="<?php bloginfo('url') ?>/wp-login.php?action=register&success=ok"/>
<input type="hidden" name="edd-registre-nonce" value="<?php echo wp_create_nonce( 'edd-registre-nonce' ); ?>"/>
<input type="hidden" name="edd_action" value="user_registre"/>
<button type="submit" class="btn-icon submit"><?php echo __( 'Create Account', 'forest' ); ?></button>
</div>
</fieldset>
</form>
register_new_user() を処理する失敗した関数は次のとおりです。
function forest_process_registre_form( $data ) {
if ( wp_verify_nonce( $data['edd-registre-nonce'], 'edd-registre-nonce' ) ) {
$errors = register_new_user($data['user_login'], $data['user_email']);
if ( isset($errors) && is_array($errors) ){
foreach($errors as $error) {
if(count($error) > 0) {
foreach($error as $e) {
edd_set_error( 'email_incorrect', $e[0]);
}
}
}
}
// Check for errors and redirect if none present
$errors = edd_get_errors();
if ( ! $errors ) {
$redirect = apply_filters( 'edd_login_redirect', $data['edd_redirect'], $user_ID );
wp_redirect( $redirect );
exit;
}
}
}
add_action( 'edd_user_registre', 'forest_process_registre_form' );
url = wp-login.php?action=register の場合は登録ページで機能しますが、そのページ外の URL に配置すると機能を完了できません。これを修正する方法はありますか? inb wordpress で実行できますか?