Merge Tag: Blog ID

Read the Walkthrough


Filename: gw-merge-tag-blog-id.php

 * Gravity Forms // Merge Tag: Blog ID
add_filter( 'gform_pre_replace_merge_tags', function( $text, $form, $lead, $url_encode, $esc_html, $nl2br, $format ) {
	if ( strpos( $text, '{blog_id}' ) !== false ) {
		$text = str_replace( '{blog_id}', get_current_blog_id(), $text );
	return $text;
}, 10, 7 );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.