Title: Expects string
Last modified: August 22, 2016

---

# Expects string

 *  Resolved [Prebyter](https://wordpress.org/support/users/prebytergmailcom/)
 * (@prebytergmailcom)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/expects-string/)
 * Hei Till,
 * in some case, the given variable to function “eae_encode_emails” is not a string.
   In my case it is an array. Which causes the following warning:
    strpos() expects
   parameter 1 to be string, array given in …/email-address-encoder/email-address-
   encoder.php on line 61
 * I fixed it roughly with an if(is_string($string)) construct. But it will be overwritten
   with your next update.
 * To reproduce the bug: I’ve installed the ACF plugin and added a select field 
   with multiple selection to my custom field.
 * Thanks for your effort!
 * [https://wordpress.org/plugins/email-address-encoder/](https://wordpress.org/plugins/email-address-encoder/)

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

 *  Plugin Author [Till Krüss](https://wordpress.org/support/users/tillkruess/)
 * (@tillkruess)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/expects-string/#post-5237794)
 * Could you send me a screenshot of your ACF field and the code you use to call`
   eae_encode_emails()`?
 *  Thread Starter [Prebyter](https://wordpress.org/support/users/prebytergmailcom/)
 * (@prebytergmailcom)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/expects-string/#post-5237870)
 * First field is a repeater field:
    [http://cl.ly/image/1C2V3u2O070c](http://cl.ly/image/1C2V3u2O070c)
 * Second field inside the first, too:
    [http://cl.ly/image/1h3Y0j2H2u0s](http://cl.ly/image/1h3Y0j2H2u0s)
 * Relevant options of the second field (select, with multiple selection true):
   
   [http://cl.ly/image/3w0l321G2B26](http://cl.ly/image/3w0l321G2B26)
 * My EAE calls in the function.php:
    add_filter(‘acf/load_value’, ‘eae_encode_emails’);
   add_filter( ‘walker_nav_menu_start_el’, ‘eae_encode_emails’ );
 * Thanks Till
 *  Plugin Author [Till Krüss](https://wordpress.org/support/users/tillkruess/)
 * (@tillkruess)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/expects-string/#post-5237879)
 * Can you try using the `acf/format_value` filter instead of `acf/load_value` and
   see if everything works as exspected?
 *  Thread Starter [Prebyter](https://wordpress.org/support/users/prebytergmailcom/)
 * (@prebytergmailcom)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/expects-string/#post-5237880)
 * Yes, it works. But if i remove the “if(is_string($string))”-construct it fails
   the same way as before.
 *  Plugin Author [Till Krüss](https://wordpress.org/support/users/tillkruess/)
 * (@tillkruess)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/expects-string/#post-5237881)
 * Can you send me an export of your ACF configuration?
 *  Thread Starter [Prebyter](https://wordpress.org/support/users/prebytergmailcom/)
 * (@prebytergmailcom)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/expects-string/#post-5237884)
 * [http://f.cl.ly/items/2U1G0h031a002j2M0E2D/advanced-custom-field-export.xml](http://f.cl.ly/items/2U1G0h031a002j2M0E2D/advanced-custom-field-export.xml)
 * // Error message appears on the edit-post.php page (not on the ACF plugin page)
 *  Plugin Author [Till Krüss](https://wordpress.org/support/users/tillkruess/)
 * (@tillkruess)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/expects-string/#post-5237904)
 * Hey!
 * One permanent solution would be this:
 *     ```
       add_filter( 'acf/format_value', function( $value ) {
   
       	if ( is_string( $value ) ) {
       		$value = eae_encode_emails( $value );
       	}
   
       	return $value;
   
       } );
       ```
   
 * Another idea would be to [target the individual fields](http://www.advancedcustomfields.com/resources/acfformat_value/)
   using one of these filters:
 *     ```
       acf/format_value/type={$field_type}
       acf/format_value/name={$field_name}
       acf/format_value/key={$field_key}
       ```
   
 * I’ll add the `is_string()` check to the next version as well.
 *  [ps3hero](https://wordpress.org/support/users/ps3hero/)
 * (@ps3hero)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/expects-string/#post-5238028)
 * had the same problem and Till’s code fixed it – thx a lot!

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

The topic ‘Expects string’ is closed to new replies.

 * ![](https://ps.w.org/email-address-encoder/assets/icon-256x256.jpg?rev=970206)
 * [Email Address Encoder](https://wordpress.org/plugins/email-address-encoder/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/email-address-encoder/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/email-address-encoder/)
 * [Active Topics](https://wordpress.org/support/plugin/email-address-encoder/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/email-address-encoder/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/email-address-encoder/reviews/)

 * 8 replies
 * 3 participants
 * Last reply from: [ps3hero](https://wordpress.org/support/users/ps3hero/)
 * Last activity: [10 years, 11 months ago](https://wordpress.org/support/topic/expects-string/#post-5238028)
 * Status: resolved