Title: Add functions before submit
Last modified: August 20, 2018

---

# Add functions before submit

 *  Resolved [prabowo](https://wordpress.org/support/users/prabowo/)
 * (@prabowo)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/add-functions-before-submit/)
 * Hi Ahn,
 * I want to ask something about meta box, is it possible to add some custom functions
   before process submitting, for example like this…
 * 1. I create an input text box on the post
    2. When I create a new post, I fill
   that text box with some value, for example, google.com 3. But then before the
   value saved I add base64 encoding 4. So when I display that value, the result
   would be Z29vZ2xlLmNvbQ==
 * I don’t want to encode the value when its display, for example, echo base64_encode(
   rwmb_meta( ‘input_id’ )); I want the encoding process happens when publish button
   pushed
 * Is it possible?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Anh Tran](https://wordpress.org/support/users/rilwis/)
 * (@rilwis)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/add-functions-before-submit/#post-10620308)
 * Hello,
 * Yes, it’s possible. Meta Box has an action `rwmb_before_save_post` that fires
   before the saving process. You can use it to do whatever you want. Read more 
   about [this action](https://docs.metabox.io/actions/#rwmb_before_save_post).
 * If all you need is just changing the value of a field before saving into the 
   database, you probably can [filter the value](https://docs.metabox.io/filters/#rwmb_field_id_value).
 *  [aanderson9021](https://wordpress.org/support/users/aanderson9021/)
 * (@aanderson9021)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/add-functions-before-submit/#post-10623366)
 * Wow I didn’t know if the plugin have this function
 * Can u give me sample how to use it? Sorry still new using this plugin and really
   interest to explore more
 * Thx for this beautiful plugin [@rilwis](https://wordpress.org/support/users/rilwis/)
 *  [autolistings](https://wordpress.org/support/users/autolistings/)
 * (@autolistings)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/add-functions-before-submit/#post-10627872)
 * If you just need to change the field value, use this code:
 *     ```
       add_filter( 'rwmb_FIELDID_value', function( $new, $field, $old ) {
           return base46_encode( $new );
       } );
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Add functions before submit’ is closed to new replies.

 * ![](https://ps.w.org/meta-box/assets/icon-128x128.png?rev=1100915)
 * [Meta Box](https://wordpress.org/plugins/meta-box/)
 * [Support Threads](https://wordpress.org/support/plugin/meta-box/)
 * [Active Topics](https://wordpress.org/support/plugin/meta-box/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/meta-box/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/meta-box/reviews/)

 * 3 replies
 * 4 participants
 * Last reply from: [autolistings](https://wordpress.org/support/users/autolistings/)
 * Last activity: [7 years, 9 months ago](https://wordpress.org/support/topic/add-functions-before-submit/#post-10627872)
 * Status: resolved