Home / Admin / Change the No Results Found text in Modern Dropdown
Duplicate Snippet

Embed Snippet on Your Site

Change the No Results Found text in Modern Dropdown

This snippet changes the default no result found text in Dropdown field with Modern style.

<10
Code Preview
php
<?php
/**
 * Change the No Results Found text in Modern Dropdown.
 *
 * @link https://wpforms.com/developers/how-to-change-the-no-results-found-text-in-the-modern-dropdown-field/
 */
 
function wpf_dev_change_modern_dropdown_noresults_text( $config, $forms ) {
     
    // Change 1369 to an ID of your actual form.
    if ( array_key_exists( 1369, $forms ) ) {
     
    $config[ 'noResultsText' ] = __( 'Apologies, your search term was not found.', 'your-text-domain' );
    }
 
    return $config;
}
 
add_filter( 'wpforms_field_select_choicesjs_config', 'wpf_dev_change_modern_dropdown_noresults_text', 10, 2 );

Comments

Add a Comment