Title: Using [wpcf7.remote_ip] With Custom Feild
Last modified: August 20, 2016

---

# Using [wpcf7.remote_ip] With Custom Feild

 *  [biastechnology](https://wordpress.org/support/users/biastechnology/)
 * (@biastechnology)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/using-wpcf7remote_ip-with-custom-feild/)
 * Hi All,
 * I’m having trouble calling the [wpcf7.remote_ip] function because I’ve used the
   below code to add a custom field.
 *     ```
       /**
       *Add RMA to Database
       */
       add_action( 'wpcf7_mail_sent', 'your_wpcf7_mail_sent_function' );
       function your_wpcf7_mail_sent_function( $contact_form ) {
       	global $wpdb;
       	$title = $contact_form->title;
       	$posted_data = $contact_form->posted_data;
       	if ( 'RequestRMA' == $title ) {
       		$company_name = $posted_data['CompanyName'];
       		$sql = $wpdb->prepare("INSERT INTO wp_rma(company_name) VALUES (%s)", $company_name);
       		$wpdb->query($sql);
       	}
       }
       /**
       *Get RMA From Database
       */
       add_filter( 'wpcf7_special_mail_tags', 'your_wpcf7_special_mail_tag_extension', 10,2);
       function your_wpcf7_special_mail_tag_extension( $outputs, $names ) {
       	global $wpdb;
       		if ( 'Get_RMA' == $names )
       			$RMA = 'Error - Please Contact 01234 567890';
       			$outputs=$wpdb->get_var( $wpdb->prepare("SELECT RMA_ID FROM wp_rma ORDER BY time_date_stamp DESC LIMIT 1"));
       		return ($outputs);
       }
       ```
   
 * When this code is used in functions.php the [wpcf7.remote_ip] function now outputs
   the ‘Get_RMA’ rather than the ip address of the user.
 * How can I keep my custom field and use the [wpcf7.remote_ip] short code to display
   the users IP address?
 * Any help would be great.
    If you need more info just ask.
 * [http://wordpress.org/extend/plugins/contact-form-7/](http://wordpress.org/extend/plugins/contact-form-7/)
 * _[Moderator Note: Please post code or markup snippets between backticks or use
   the code button. Or better still – use a [pastebin](http://pastebin.com/). As
   it stands, your posted code may now have been permanently damaged/corrupted by
   the forum’s parser.]_

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

 *  Thread Starter [biastechnology](https://wordpress.org/support/users/biastechnology/)
 * (@biastechnology)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/using-wpcf7remote_ip-with-custom-feild/#post-3338487)
 * Hi Anyone have any ideas?
 * Thanks
 *  Thread Starter [biastechnology](https://wordpress.org/support/users/biastechnology/)
 * (@biastechnology)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/using-wpcf7remote_ip-with-custom-feild/#post-3338527)
 * Hi guys, I’m still having trouble with this.
 * Any Help?
 * Thanks
 *  Thread Starter [biastechnology](https://wordpress.org/support/users/biastechnology/)
 * (@biastechnology)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/using-wpcf7remote_ip-with-custom-feild/#post-3338532)
 * REPOST
 * Hi guys, I’m still having trouble with this.
 * Any Help?
 * Thanks
 *  [D.Q](https://wordpress.org/support/users/dq-1/)
 * (@dq-1)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/using-wpcf7remote_ip-with-custom-feild/#post-3338533)
 * **Hi**
 * This worked for me 🙂
 * [http://wordpress.org/support/topic/contact-form-7-show-ip?replies=8](http://wordpress.org/support/topic/contact-form-7-show-ip?replies=8)
 *  Thread Starter [biastechnology](https://wordpress.org/support/users/biastechnology/)
 * (@biastechnology)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/using-wpcf7remote_ip-with-custom-feild/#post-3338538)
 * Hi D.Q,
 * Thanks for the link.
 * I’ve tried that, and when I use the [wpcf7.remote_ip] in the main message area,
   I just get back my custom variable for my custom field [Get_RMA].
 * I’m hoping that Takayuki Miyoshi will see this and offer some help.
 * Cheers

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

The topic ‘Using [wpcf7.remote_ip] With Custom Feild’ 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/)

## Tags

 * [custom field](https://wordpress.org/support/topic-tag/custom-field/)

 * 5 replies
 * 2 participants
 * Last reply from: [biastechnology](https://wordpress.org/support/users/biastechnology/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/using-wpcf7remote_ip-with-custom-feild/#post-3338538)
 * Status: not resolved