black friday sale

Custom Fields
Re-Envisioned
Support MB Frontend Submission rwmb_frontend_after_process set static value

  • Creator
    Topic
  • #13572
    knms5525
    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?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #13609
    Anh 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
    Dave
    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 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.