Title: access array inside widget api class
Last modified: August 20, 2016

---

# access array inside widget api class

 *  [mikegoodstadt](https://wordpress.org/support/users/mikegoodstadt/)
 * (@mikegoodstadt)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/access-array-inside-widget-api-class/)
 * I am writing a plugin which makes new widgets by extending the widget class as
   shown in the Widget API. I have an array, used to build a menu, which I want 
   to access in “public function update”, “public function form” and my widget functions.
   But I can’t figure out clearly how to do this. So for now it is recreated in 
   each function… Can anyone help me understand where to place this array to allow
   access through the widget code?
    Many thanks, Mike
 * Here is the array:
 *     ```
       $menu_array = array(
       			'Find' => array("surname", "bookmarks", "places", "anniversaries", "calendar", "cemeteries", "searchform", "famsearchform"),
       			'Media' => array("photos", "documents", "headstones", "histories", "recordings", "videos", "albums", "all"),
       			'Info' => array("whatsnew", "mostwanted", "reports", "statistics", "browsetrees", "browsenotes", "browsesources", "browserepos", "suggest")
       			);
       ```
   

The topic ‘access array inside widget api class’ is closed to new replies.

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)
 * [array](https://wordpress.org/support/topic-tag/array/)
 * [class](https://wordpress.org/support/topic-tag/class/)
 * [widget](https://wordpress.org/support/topic-tag/widget/)

 * 0 replies
 * 1 participant
 * Last reply from: [mikegoodstadt](https://wordpress.org/support/users/mikegoodstadt/)
 * Last activity: [13 years, 7 months ago](https://wordpress.org/support/topic/access-array-inside-widget-api-class/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
