Using Bulk Edit Custom Fields plugin

You can add several posts to channels or playlists using Bulk Edit Custom Fields plugin (Posts > Bulk Edit Fields) or similar plugins. VideoPro uses channel_idplaylist_id, and actor_id custom fields of post to assign a post to a channel or playlist.

However, there is one important issue to note: it saves serialized value of IDs array, not single integer value. Thus, you will need to use serialized value of array to use with Bulk Edit Custom Fields plugin.

 

The bad thing is Bulk Edit Custom Fields does not allow to set serialized value for custom field. It understands value as string. So, we will need a little change in the plugin like this: open /custom-field-bulk-editor/custom-field-bulk-editor.php, at line 460, add this code

$new_data = apply_filters('cfbe_value_before_saving', $new_data, $fieldname);

(the whole cfbe_save_meta_data function would look like this

function cfbe_save_meta_data($fieldname,$input) {
    global $post_id;
    $current_data = get_post_meta($post_id, $fieldname, TRUE);
    $new_data = $input;
    if (!$new_data || $new_data == "") $new_data = NULL;
    cfbe_meta_clean($new_data);
    $new_data = apply_filters('cfbe_value_before_saving', $new_data, $fieldname);
    if ($current_data && is_null($new_data)) {
        delete_post_meta($post_id,$fieldname);
    } elseif ($current_data && !isset($_POST['cfbe_add_new_values'])) {
        update_post_meta($post_id,$fieldname,$new_data);
    } elseif (!is_null($new_data)) {
        add_post_meta($post_id,$fieldname,$new_data);
    }
}

Now one more step, add this piece of code into your theme or child theme’s functions.php 

add_filter('cfbe_value_before_saving', 'cfbe_value_before_saving_filter', 10, 2);
function cfbe_value_before_saving_filter( $value, $field ){
    if(in_array($field, array('actor_id', 'channel_id', 'playlist_id'))){
        $value = unserialize($value);
    }

    return $value;
}

All done! Now you are able to bulk edit those serialized value data.

php-serialize-array

You can use this tool: http://php.fnlist.com/php/serialize to get serialized value of an array. For example, you will to add posts to channels having IDs 100 and 101. You will need to get serialized value of array(100,101). Paste that string into the convert tool, you will get this string: a:2:{i:0;i:100;i:1;i:101;} That’s the value you should use for Bulk Edit Custom Fields plugin.

bulkeditcustomfields-plugin-channel_id