Fields in custom table come back as undefined
-
Hi, first I am completely new to WordPress programming so please forgive me…
I have created a custom table named wp_sf_groups with 3 fields:
id
sf_id
sf_nameI have inserted the object type code and the table properly shows in the WordPress Object dropdown. However, when I try to select the field, the Worpress dropdown only displays:
undefined
undefined
undefinedI am not quite sure where to insert the hook and whether I need to define the fields themselves. I imagine it is looking at the table as it is returning 3 fields. It is also replacing all my dropdowns for any object type with the same 3 undefined fields.
Here is the code I added as well as the default code above and below it to show placement in the file. Any advice would be extremely helpful.
/*
* Developers can use this hook to change the WordPress object field array.
* The returned $object_fields needs to be an array like is described earlier in this method:
* $object_fields = array( ‘data’ => array(), ‘from_cache’ => bool, ‘cached’ => bool );
* This is useful for custom objects that do not use the normal metadata table structure.
*/
add_filter( ‘object_sync_for_salesforce_wordpress_object_fields’, ‘add_field’, 10, 2 );
$object_fields[‘data’][] = array(
‘key’ => ‘id’,
‘table’ => ‘sf_groups’,
‘methods’ => array (
‘create’ => ‘sf_groups_plugin_create’,
‘read’ => ‘sf_groups_plugin_read’,
‘update’ => ‘sf_groups_plugin_update’,
‘delete’ => ‘sf_groups_plugin_delete’
)
);
return $object_fields;$object_fields = apply_filters( $this->option_prefix . ‘wordpress_object_fields’, $object_fields, $wordpress_object );
return $object_fields[‘data’];
}
- The topic ‘Fields in custom table come back as undefined’ is closed to new replies.