Title: Bug when generating field via Code   Solution   Question
Last modified: August 20, 2016

---

# Bug when generating field via Code Solution Question

 *  [schnause](https://wordpress.org/support/users/schnause/)
 * (@schnause)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/bug-when-generating-field-via-code-solution-question/)
 * Version of the plugin: 1.2.2
 * I’m trying to generate a simple field via code. In my `functions.php` I’m doing
   the following stuff:
 *     ```
       simple_fields_register_field_group ( 'my_test', array(
         'name' => 'Test',
         'description' => 'This is a test',
         'repeatable' => 1,
         'fields' => array(
           array(
             'slug' => 'location',
             'name' => 'Location',
             'description' => '',
             'type' => 'googlemaps'
           )
         )
       ));
       ```
   
 * When I do so everything works fine but using the simple field in a blogpost doesn’t
   show a map. This is because of line 180 and 181 in the file `simple-fields-map-
   extension.php` which are
 *     ```
       $options["defaultMapTypeId"],
       $options["defaultZoomLevel"],
       ```
   
 * A working solution is
 *     ```
       isset($options["defaultMapTypeId"]) ? $options["defaultMapTypeId"] : "HYBRID",
       isset($options["defaultZoomLevel"]) ? $options["defaultZoomLevel"] : 10,
       ```
   
 * where I’ve taken the default values from your code.
 * Another problem is, that there is no default pointer when generating via code
   like I do. I think the reason is the same as above because the values do not 
   exist and therefore it is not possible to show a default marker. Can you have
   a look at it?
 * I also have an additional question that belongs to this topic. When generating
   the simple field via code how do I attach my own values like the default position,
   zoom level, etc.?Can you give an example because I’ve found nothing on your website.
 * Thanks in advance for answering the questions/bugfixing and also for the great
   plugin in general. Very good work! 🙂
 * [http://wordpress.org/extend/plugins/simple-fields-map-extension/](http://wordpress.org/extend/plugins/simple-fields-map-extension/)

The topic ‘Bug when generating field via Code Solution Question’ is closed to new
replies.

 * ![](https://s.w.org/plugins/geopattern-icon/simple-fields-map-extension_d8dde0.
   svg)
 * [Simple Fields Map extension](https://wordpress.org/plugins/simple-fields-map-extension/)
 * [Support Threads](https://wordpress.org/support/plugin/simple-fields-map-extension/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-fields-map-extension/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-fields-map-extension/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-fields-map-extension/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [schnause](https://wordpress.org/support/users/schnause/)
 * Last activity: [13 years, 2 months ago](https://wordpress.org/support/topic/bug-when-generating-field-via-code-solution-question/)
 * Status: not resolved