Title: Accessing array-defined action
Last modified: September 28, 2021

---

# Accessing array-defined action

 *  Resolved [loopforever](https://wordpress.org/support/users/loopforever/)
 * (@loopforever)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/accessing-array-defined-action/)
 * Hello,
    In a plugin file there is an action defined as follows. It contains a
   parameter of type array as you can see:
 * `do_action('vse_da_update',$id,$data[$rkey],$status);`
 * I’m trying to handle this by reaching it in function.php. However, I cannot reach
   it. am i making a mistake? Is the parameter as an array being accessed in a different
   way?
 *     ```
       add_action('vse_da_update', 'new_vse_da_update', 10, 2);
       function new_vse_da_update ($id, $data){
       $new_value[$id] = $data[$rkey];
       }
       ```
   
    -  This topic was modified 4 years, 8 months ago by [loopforever](https://wordpress.org/support/users/loopforever/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Jacob Peattie](https://wordpress.org/support/users/jakept/)
 * (@jakept)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/accessing-array-defined-action/#post-14917437)
 * This just means that the action is passing whatever value is inside `$data[$rkey]`
   as a variable. It will be a normal single variable in the callback function that
   you can access, with whatever name you choose:
 *     ```
       add_action('vse_da_update', 'new_vse_da_update', 10, 2);
       function new_vse_da_update ($id, $data){
       	$new_value[$id] = $data;
       }
       ```
   
 * This is the same as if you pass a value to a function:
 *     ```
       funtion do_something( $value ) {
       	echo $value;
       }
   
       $data = [
       	'key' => 'value',
       ];
   
       do_something( $data['key'] ); // 'value'
       ```
   
 *  Thread Starter [loopforever](https://wordpress.org/support/users/loopforever/)
 * (@loopforever)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/accessing-array-defined-action/#post-14917551)
 * Thank you very much for your reply. Problem is solved.
    -  This reply was modified 4 years, 8 months ago by [loopforever](https://wordpress.org/support/users/loopforever/).
    -  This reply was modified 4 years, 8 months ago by [loopforever](https://wordpress.org/support/users/loopforever/).
    -  This reply was modified 4 years, 8 months ago by [loopforever](https://wordpress.org/support/users/loopforever/).

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Accessing array-defined action’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 2 participants
 * Last reply from: [loopforever](https://wordpress.org/support/users/loopforever/)
 * Last activity: [4 years, 8 months ago](https://wordpress.org/support/topic/accessing-array-defined-action/#post-14917551)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
