Get new registered user id

[ad_1]

Hi @mor3311

I hope you’re well today!

It requires some additional code but would be possible. Here’s the code that you can use for this:

With this exact code you’d get user ID in userid variable in line 60.

This particular code is meant to be used with forms that have both registration and postdata field on them, in order to register user, create post and then automatically assign that new user as post author. But you can easily change the code to work without postdata field (post creation); simply remove lines number

41

and from 62 to 71 (including).

Best regards,
Adam

I customized the code for my needs and it works, thanks!! 🙂

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer