# לא ניתן ליצור משתמש ב-Discourse מ-WP עם טופס הרשמה חדש

**URL:** <https://meta.discourse.org/t/unable-to-create-user-in-discourse-from-wp-with-new-registration-form/233700>\
**Category:** WordPress\
**Created:** [22 ביולי,‏ 2022,‏ 9:36pm UTC](https://meta.discourse.org/t/unable-to-create-user-in-discourse-from-wp-with-new-registration-form/233700 "2022-07-22T21:36:27Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![Himanshu\_Singh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/himanshu_singh/32/216438_2.png) [@Himanshu\_Singh](https://meta.discourse.org/u/Himanshu_Singh)\
**Post date:** [28 ביולי,‏ 2022,‏ 4:39pm UTC](https://meta.discourse.org/t/unable-to-create-user-in-discourse-from-wp-with-new-registration-form/233700/10 "2022-07-28T16:39:13Z")

</div>

Now it all makes sense. Thanks, Angus.

I have the “Create or Sync Discourse Users on Login” setting checked. The user is not getting created in Discourse because some users register on WP but do not visit the community on first login. They might come back and login and then click on community URL and then the user is created.

The current auto login after registration on WP does not use WP\_login

```plaintext
add_action( 'cred_save_data', 'cred_autologin_V3', 10, 3 );
    
function cred_autologin( $post_id, $form_data ){
  if ( ID1 == $form_data['id'] ) { // Edit as required
    wp_set_current_user( $post_id );
    wp_set_auth_cookie( $post_id );
// wp_redirect( home_url( '/some-ending-page/' ) );
  // exit(); 
  }
}

```

I would prefer to create the user in Discourse on WP registration.  
I have custom hooks on the user registration form that can run the API. Is there a code I can add to the custom hook to create a user in Discourse via the API?

> [@angus](#):
>
> . This setting uses the wp action `wp_login`, so your user registration process has to trigger that action for this feature to work.

This is the part I don’t know how to do i.e. trigger wp\_login from a custom hook.

---

_[View the full topic](https://meta.discourse.org/t/unable-to-create-user-in-discourse-from-wp-with-new-registration-form/233700)._
