: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Replace 3rd-party form provider tags/shortcodes with our own Smart Tags.
* @param string $string Text to look for Smart Tags in.
* @param array $fields List of fields to process Smart Tags in.
public function get_smarttags( $string, $fields ) {
preg_match_all( '/\{(.+?)\}/', $string, $tags );
if ( empty( $tags[1] ) ) {
foreach ( $tags[1] as $tag ) {
$tag_formatted = str_replace( 'field:', '', $tag );
foreach ( $fields as $field ) {
if ( ! empty( $field['nf_key'] ) && $field['nf_key'] === $tag_formatted ) {
$string = str_replace( '{' . $tag . '}', '{field_id="' . $field['id'] . '"}', $string );
if ( in_array( $tag, [ 'wp:admin_email', 'system:admin_email' ], true ) ) {
$string = str_replace( [ '{wp:admin_email}', '{system:admin_email}' ], '{admin_email}', $string );
if ( $tag === 'all_fields_table' || $tag === 'fields_table' ) {
$string = str_replace( '{' . $tag . '}', '{all_fields}', $string );