Events Manager and WCK Custom Fields and Custom Post Types Creator conflict
This time I had a conflict using those two plugins in one of my WordPress websites:
http://wordpress.org/plugins/events-manager/
http://wordpress.org/plugins/wck-custom-fields-and-custom-post-types-creator/
Events Manager is a great plugin for events. It creates new custom post type – events. WCK is also powerful plugin for creating custom fields and custom post types.
I wanted to add some custom fields using WCK into events post type. Unfortunately on event save post all custom fields were extra serialized. It’s because Event Manager plugin treats it as “event attributes”.
So far the best solution for me is to add this code in functions.php:
1 2 3 4 5 |
function aspexi_keep_wck( $obj ) { unset( $obj->event_attributes['wck_meta_name'] ); unset( $obj->attributes['wck_meta_name'] ); } add_action('em_event_save_meta_pre', 'aspexi_keep_wck', 10, 1); |
Where “wck_meta_name” is a custom field meta name (not field slug) you want use for events.
Tested on WordPress 3.8.1, WCK 1.0.7 and Events Manager 5.5.2.