How do I set submission posts to private?

Support MB Frontend Submission How do I set submission posts to private?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #32033
    Andrew_VincentAndrew_Vincent
    Participant

    Hi there.

    This is probably a simple thing but I couldn't find in the documentation...

    I've set up a front-end form for my client to receive expressions of interest eg:
    https://flexigrain.com.au/pools-strategies/hectare-based-contracts/expression-of-interest-wa/

    Everything works fine but each submission creates a post which at the moment is publicly visible. ie. peoples contact details can be trawled by crawlers.

    How do I set the generated submission post to be Private?

    Current code:

    add_filter( 'rwmb_meta_boxes', function ( $meta_boxes ) {
    
    $meta_boxes[] = array (
        'title' => 'Submit Paddock',
        'id' => 'submit_tonnage_form_nsw',
                'post_types' => 'post',
                'validation'    =>  [
                     'rules' =>  [...]
                 ],
        'fields' => [...]
        );
    
    return $meta_boxes;
    
    });

    ... which is then added to front-end via shortcode.

    #32041
    Long NguyenLong Nguyen
    Moderator

    Hi,

    You can use the attribute post_status to set the post status private for posts submitted via the frontend form.

    [mb_frontend_form id="meta-box-id" post_fields="title,content" post_status="private"]
    

    Please get more details on the documentation https://docs.metabox.io/extensions/mb-frontend-submission/#shortcode-attributes

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.