Title: multiple event names?
Last modified: August 21, 2016

---

# multiple event names?

 *  Resolved [Stephanie Leary](https://wordpress.org/support/users/sillybean/)
 * (@sillybean)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/multiple-event-names/)
 * I’m working on a [site](http://lettermo.com) that has per-category achievements.
   This has been tricky to set up. Right now, I’m manually creating new actions 
   for each category in addition to the first action, which occurs any time someone
   posts to this CPT:
 *     ```
       $this->actions = array(
       'lettermo_new_letter' => __( 'The user sends a letter', 'dpa' ),
       'lettermo_new_package' => __( 'The user sends a package', 'dpa' ),
       'lettermo_new_intl' => __( 'The user sends international mail', 'dpa' ),
       );
       ```
   
 * … and then mapping them to event names like so:
 *     ```
       if ( 'letter' !== $func_args[0]->post_type )
       	return $event_name;
   
       $postid = $func_args[0]->ID;
   
       // Switch the event names for Letters
       if ( has_term( 'package', 'extras', $postid ) )
       	return 'lettermo_new_package';
   
       if ( has_term( 'international', 'extras', $postid ) )
       	return 'lettermo_new_intl';
   
       return 'lettermo_new_letter';
       ```
   
 * (Full code here: [https://gist.github.com/sillybean/8718584](https://gist.github.com/sillybean/8718584))
 * That is, if the post has a term from the ‘extras’ taxonomy, return that event
   name; otherwise use the default.
 * This works as long as I have only one term selected per post. I’m going to be
   in trouble as soon as someone tries to mix them — e.g. sending an international
   package.
 * Is there a way to return multiple event names? I tried an array and it didn’t
   appear to work.
 * [http://wordpress.org/plugins/achievements/](http://wordpress.org/plugins/achievements/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Paul Wong-Gibbs](https://wordpress.org/support/users/djpaul/)
 * (@djpaul)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/multiple-event-names/#post-4561906)
 * Hi Stephanie,
 * I don’t mean for this to sound abrupt, but no; it needs to be a string. 🙂

Viewing 1 replies (of 1 total)

The topic ‘multiple event names?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/achievements.svg)
 * [Achievements for WordPress](https://wordpress.org/plugins/achievements/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/achievements/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/achievements/)
 * [Active Topics](https://wordpress.org/support/plugin/achievements/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/achievements/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/achievements/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Paul Wong-Gibbs](https://wordpress.org/support/users/djpaul/)
 * Last activity: [12 years, 4 months ago](https://wordpress.org/support/topic/multiple-event-names/#post-4561906)
 * Status: resolved