Custom Fields
Support General serilaze image field values and update another field

  • Creator
  • #7889


    I need to add some image field values and update these values to another custom field with serialized format...

    For example my metabox image field is image_field

    My custom post meta field is image_gallery . I dont use this field with metabox plugin

    After i insert or update or save post i want update image_gallery post meta to be updated with image_field values with serilazied format..Also i want to do this in front-end with front end sub extension.

    I think i can do that with rwmb_after_save_post action.

    I am doing this with another plugin. Here i share the snippet with you which i use for another plugin.

    function wpuf_woo_product_gallery( $post_id ) {
    if ( isset( $_POST['wpuf_files']['image_field'] ) ) {

    $images = get_post_meta($post_id, 'image_field' );
    update_post_meta( $post_id, 'image_gallery', implode(',', $images) );

    $serialize = maybe_serialize( $images );
    update_post_meta( $post_id, 'image_gallery', $serialize );


    add_action( 'wpuf_add_post_after_insert', 'wpuf_woo_product_gallery' );
    add_action( 'wpuf_edit_post_after_update', 'wpuf_woo_product_gallery' );

    Can you share a snippet to do this with Metabox if possible ? Sorry that i am not a developer.


  • You must be logged in to reply to this topic.