You just need to reorder your function. Create your user before you enter your post, then the 'post_author' => $user_id
field will actually have a value.
Related Posts:
- How to display user registration form on front-end of the website?
- What is an easy way to display a front-end user registration form?
- How to edit a user profile on the front end?
- User registration problem in WordPress
- Custom Registration Template/Page
- Registration form labels – add asterisk
- Autocomplete for taxonomy input boxes on a front end form
- How to create and retrieve data from a special registration form?
- Built-in data validation function for URLs
- Front End Registration Form Code – Password Field Not Saving
- How to edit custom user meta information front end
- How to redirect new WordPress user to previous page after registering
- How can I create registration form for users which I can assign role and profile picture?
- Saving frontend form data in wordpress
- Validating custom fields before post save
- Downloadable content only for subscribers?
- Create a registration form with a PayPal checkout fee? [closed]
- Front end register with custom fields
- How can I modify labels in default wordpress registration form? [duplicate]
- Display number of sign-ups [closed]
- WordPress Frontend Post Form (Bootstrap Modal) Not Creating Post
- Front end update_post_meta Help
- Headers already sent on a frontend post form using wp_redirect before get_header
- WordPress – Users with contact form on profile
- How to call or add password input / generate password / password strenght meter in custom registration form?
- wp_nonce for Front-End submission form not working
- Update a string from the front-end
- Username from e-mail
- Create register form plus send post
- WordPress – custom user flow registration approval
- How do I register user without being authenticated
- How to reproduce the post format field in a front end form?
- What is & used for
- How to define form action in JSF?
- Free or affordable OCR and ICR (handwriting recognition) SDK?
- What characters are allowed in an email address?
- How to include landing page with form submission?
- How to handle form submission?
- Add error message on password protected page
- Set Featured Image Front Frontend Form
- WordPress AJAX File Upload – FrontEnd
- how to set from address according to the form input email address for wp_mail()?
- How to get current url in contact form 7
- How to let user set password on registration
- Is wp_nonce_field vulnerable if you know the action name?
- How to pass on Google Adwords gclid variable to other pages
- using update_user_meta in form to set and get custom meta
- Front End Post Save Child terms
- Best way to create multi-step form with data saved to user account for later updating?
- Custom form, shortcode, and submit handler
- Let readers suggest edits from the frontend
- Creating a contact form without a plugin [closed]
- How to submit data from HTML form?
- How to link WordPress heartbeat to ajax form
- show image in mail contact form 7 [closed]
- Can I verify nonce which was generated on a different WP site?
- Submitting post to database then redirecting to paypal
- Saving two categories from two dropdowns in front end posting form
- Get user input from a form
- Sending form data via PHPMailer – How to action PHP script from a form
- Contact form 7 Dynamic text – placeholder on GET field
- Settings API erases itself?
- how to handle forms in multiple pages?
- Redirect after successful registration with fronted registration form
- set_query_var doesn’t seem to work on init hook
- Reason action hook won’t work with update_post_meta from frontend form? Alternative?
- How to send multipart form data to WordPress endpoint
- need to add attach thumbnail from my form
- Wp_mail Returning False on Server
- Advice on setting up a site with front end registration
- recommended practice for form submission
- Placeholders in Jetpack Contact Form [closed]
- How to update selective options on plugin settings page
- How to hook into user registration process Before user registers
- $_POST empty on submit (same code, same form submits normally on local server)
- Gravity Forms skip form if already filled out using cookie?
- Loading scripts & styles from a meta box callback function
- Checkbox won’t check when label is clicked
- One comment per user per post
- Front-End Interfaces Without Shortcodes
- Looking for a simple approach for handling user $_POST data without AJAX?
- Registration e-mail check with AJAX
- Datepicker not supporting timepicker
- Trying to save and display a wp_editor()
- Is there any good tutorial to write custom login, registration and password recovery forms? [closed]
- Change register form action url
- How to return variables from admin-post.php
- Help with verifying google recaptcha in a custom form
- Nonce actions and names available via open source
- Setting specific image size for specific form upload file field
- Duplicating/Cloning Multiple Form Fields
- WordPress registration and contact form 7 [closed]
- Contact forms going into spam folder
- Get data from dropdown and update page
- Mail Form in a modal box without plugin
- Using the WordPress selected() function
- Performing a POST action on homepage goes to posts page
- Add contact form
- How am I able to get the value out of cookie array when I push a button?
- 404 on form submit [duplicate]