Title: Patterns in content message
Last modified: July 17, 2024

---

# Patterns in content message

 *  Resolved [Mo](https://wordpress.org/support/users/nadhonar/)
 * (@nadhonar)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/patterns-in-content-message/)
 * Hi there
 * Is it possible to use patterns in content message?
 * For example, I can insert the _-Variable- _display name {display_name} of the
   subscriber (WP user) in content message of SMS.
 * Regards

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

 *  [Amir](https://wordpress.org/support/users/amirfallah/)
 * (@amirfallah)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/patterns-in-content-message/#post-17895536)
 * Hi [@nadhonar](https://wordpress.org/support/users/nadhonar/)
 * This option is not currently available, but it is planned to be added in the 
   redesign of the SMS sending page in future updates.
 * However, for now, You can use the `wp_sms_single_dispatch_arguments` filter.
 * For more information and how to use this filter, please refer to the link below:
   
   [https://wp-sms-pro.com/resources/filter-wp_sms_single_dispatch_arguments/](https://wp-sms-pro.com/resources/filter-wp_sms_single_dispatch_arguments/)
 * Please let me know if you have any further questions or need assistance.
   Regards,
    -  This reply was modified 1 year, 10 months ago by [Amir](https://wordpress.org/support/users/amirfallah/).
 *  Thread Starter [Mo](https://wordpress.org/support/users/nadhonar/)
 * (@nadhonar)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/patterns-in-content-message/#post-17895904)
 * Right; Could you please provide me the filter code in order to insert {display_name}
   into the content message.
 * Regards
 *  Plugin Author [Mostafa Soufi](https://wordpress.org/support/users/mostafas1990/)
 * (@mostafas1990)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/patterns-in-content-message/#post-17897020)
 * An example should be like this
 *     ```wp-block-code
       add_filter('wp_sms_single_dispatch_arguments', function ($arguments) {    // Retrieve the subscriber by mobile number    $subscriber = \WP_SMS\Newsletter::getSubscriberByMobile($arguments['to']);    // Retrieve the user by phone number    $user = \WP_SMS\Helper::getUserByPhoneNumber($arguments['to']);    // If the subscriber exists, replace {display_name} with the subscriber's name    if ($subscriber) {        $arguments['msg'] = str_replace('{display_name}', $subscriber->name, $arguments['msg']);    }    // If the user exists, replace {display_name} with the user's display name    elseif ($user) {        $arguments['msg'] = str_replace('{display_name}', $user->display_name, $arguments['msg']);    }    // Return the modified arguments    return $arguments;});
       ```
   
 * Please consider the Delivery Method in the settings should be set on “**Batch
   SMS Queue**“
 * Best
 *  Thread Starter [Mo](https://wordpress.org/support/users/nadhonar/)
 * (@nadhonar)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/patterns-in-content-message/#post-17897054)
 * I appreciate you.
 * Regards
 *  Plugin Author [Mostafa Soufi](https://wordpress.org/support/users/mostafas1990/)
 * (@mostafas1990)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/patterns-in-content-message/#post-17897058)
 * Your welcome 🙂

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

The topic ‘Patterns in content message’ is closed to new replies.

 * ![](https://ps.w.org/wp-sms/assets/icon.svg?rev=3477319)
 * [WSMS (formerly WP SMS) – SMS & MMS Notifications with OTP and 2FA for WooCommerce](https://wordpress.org/plugins/wp-sms/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-sms/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-sms/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-sms/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-sms/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-sms/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [Mostafa Soufi](https://wordpress.org/support/users/mostafas1990/)
 * Last activity: [1 year, 10 months ago](https://wordpress.org/support/topic/patterns-in-content-message/#post-17897058)
 * Status: resolved