Support Forum
Support › MB Frontend Submission › First submission from non-logged in users failsResolved
When not logged in, the first time the Frontend Submission form is submitted it fails. It simply reloads the page without error and clears all fields. When re-entering content and submitting it again, it works fine. I disabled all plugins, switched to the TwentyTwenty theme and reduced the code to the shortcode to the bare minimum. It still did not work. (Switched it back now.)
Sample Shortcode: [mb_frontend_form post_fields="title,content" post_type="post"]
More complex page I am trying to make work: https://mm.thewebtailors.net/submit-a-museum/
Running all the newest available versions.
Any help is appreciated. I can set up a staging site for you to work with.
Hi Johannes,
It's the behavior of the WordPress core when you are in the backend, click Add new post, leave all blank (title, content ...) and just click Publish, it will save a new post with the title (no title).
So when you are in the frontend (not logged in), the extension MB Frontend Submission does the same thing, leave all fields blank and click Submit, a new post is created with the title (No title).
You can make a/some fields required when submitting the post by adding the setting required => true
to the field or use the Validation.
https://docs.metabox.io/extensions/mb-frontend-submission/#reorder-post-fields
$meta_boxes[] = [
'title' => 'Bill Submit',
'id' => 'bill',
'fields' => [
[
'name' => 'Submission Date',
'id' => 'submission_date',
'type' => 'date',
],
[
'name' => 'Title',
'id' => 'post_title', // THIS
'required' => true,
],
[
'name' => 'Type',
'id' => 'type',
'type' => 'select',
'options' => [
'docs' => 'Document',
'receipt' => 'Receipt',
],
],
[
'name' => 'Description',
'type' => 'textarea',
'id' => 'post_content', // THIS
],
[
'name' => 'Thumbnail',
'type' => 'single_image',
'id' => '_thumbnail_id', // THIS
],
],
]
Thank you Long for your reply! Switching the title and content from within the shortcode to the custom metabox did the trick. 🙂