Title: Modify shortcode output
Last modified: August 21, 2016

---

# Modify shortcode output

 *  [dacrosby](https://wordpress.org/support/users/dacrosby/)
 * (@dacrosby)
 * [12 years ago](https://wordpress.org/support/topic/modify-shortcode-output/)
 * Is there a way to modify the output of fields prior to sending the email?
 * For example, `[select ddm "1" "2" "3"]` is useful for my database but in the 
   confirmation email sent I’d like it to show `"1"=>"One", "2"=>"Two", "3"=>"Three"`.
   
   Likewise, I have a form where the email field is optional. I want the form value
   seen to users to be blank, but if they leave it blank when it’s submitted the
   form fails to send so it needs to be replaced with “not-provided@example.com”
   or similar on submit.
 * I understand the PHP logic to do the string switching, I’m just not sure where
   to put the code (or which filter to attach to).
 * [https://wordpress.org/plugins/contact-form-7/](https://wordpress.org/plugins/contact-form-7/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [dacrosby](https://wordpress.org/support/users/dacrosby/)
 * (@dacrosby)
 * [12 years ago](https://wordpress.org/support/topic/modify-shortcode-output/#post-4916644)
 * Well, I’m close:
 *     ```
       add_action("wpcf7_posted_data", "wpcf7_modify_this");
       function wpcf7_modify_this($posted_data) {
       	// user doesn't enter an email
       	if ($posted_data['email'] == "")
       		$posted_data['email'] = "not-supplied@example.com";
       	// sets preferred-date radio value to "yes"
       	if ($posted_data['preferred-date'] == "-1")
       		$posted_data['preferred-date'] = "Anytime";
       	return $posted_data;
       }
       ```
   
 * The thing to note here is that validation occurs prior to this point.

Viewing 1 replies (of 1 total)

The topic ‘Modify shortcode output’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [dacrosby](https://wordpress.org/support/users/dacrosby/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/modify-shortcode-output/#post-4916644)
 * Status: not resolved