rwmb_frontend_after_process set static value

Support MB Frontend Submission rwmb_frontend_after_process set static value

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #13572
    knms5525knms5525
    Participant

    I'm using rwmb_frontend_after_process to assign a post_title like this:

    $wpdb->update( $wpdb->posts, array( 'post_title' => $NAME ), array( 'ID' => $post_id ) );

    BUT i also need to assign a value to a separate metabox field at the same time. How can I do this?

    #13609
    Anh TranAnh Tran
    Keymaster

    Hi,

    If you use rwmb_frontend_after_process, then all the data are already processed. To assign a value to another field before it's processed, I think you need rwmb_frontend_before_process hook. Then you can modify the $_POST array to change the other field's value.

    #17477
    DaveDave
    Participant

    Hi, I found this question while trying to figure out how to generate a post_title by combining several metabox fields. I tried modifying the $_POST['post_title'] = $_POST['FIELD_NAME1'] . ' ' . $POST['FIELD_NAME2']; in the 'rwmb_frontend_before_process' hook but nothing changed. I emailed myself json_encode($_POST) after the change and it did change the $_POST['post_title'] but when the save is made to the database it is not correct. Please help me understand what I'm doing wrong.

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