Title: Bug Array parsed into urlencode()
Last modified: September 23, 2016

---

# Bug Array parsed into urlencode()

 *  [dannykater](https://wordpress.org/support/users/dannykater/)
 * (@dannykater)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/bug-array-parsed-into-urlencode/)
 * When YITH Product Filter plugin is activated, on adding a product (edit-product.
   php) below Array is parsed into the urlencode() function from formatting line
   4695 and causes below error:
 * `Warning: urlencode() expects parameter 1 to be string, array given in /homepages/
   10/d622714196/htdocs/clickandbuilds/OoOCAZ/wp-includes/formatting.php on line
   4695`
 *     ```
       Array
       (
           [0] => 1528
       )
       ```
   

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

 *  Plugin Author [YITHEMES](https://wordpress.org/support/users/yithemes/)
 * (@yithemes)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/bug-array-parsed-into-urlencode/#post-8230056)
 * hi [@dannykater](https://wordpress.org/support/users/dannykater/),
 * you use the latest version of product filter plugin ?
    I tested the plugin in
   local installation but this problem doesn’t appears.
 * Let me know.
    Have a nice day YITH
 *  Thread Starter [dannykater](https://wordpress.org/support/users/dannykater/)
 * (@dannykater)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/bug-array-parsed-into-urlencode/#post-8480070)
 * Hi YITH,
 * Yes my plugin is up to date. Just updated again.
 * Now the product gets the right category, but still showing this error when YITH
   Product Filter Plugin is activated.
 * `Warning: urlencode() expects parameter 1 to be string, array given in /homepages/
   44/d643316445/htdocs/clickandbuilds/Surfsnb/wp-includes/formatting.php on line
   4695`
 *  [nnyorker](https://wordpress.org/support/users/nnyorker/)
 * (@nnyorker)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/bug-array-parsed-into-urlencode/#post-8483500)
 * Any luck with this? Same problem.
 *  Thread Starter [dannykater](https://wordpress.org/support/users/dannykater/)
 * (@dannykater)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/bug-array-parsed-into-urlencode/#post-8483896)
 * For now I just edited WP’s wp-includes/formatting.php from line 4694 and added:
 *     ```
       	$array = $path;
       	$can_foreach = is_array($array) || is_object($array);
       	if ($can_foreach) {
       		foreach ($array as $single_path){
       			$path = $single_path;
       		}
       	}
       ```
   
 * This changes the array to an string. Will be removed once WP is updated, so hope
   that YITH can reproduce the error and solve it asap.
 * Cheers.
 *  [localbrands](https://wordpress.org/support/users/localbrands/)
 * (@localbrands)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/bug-array-parsed-into-urlencode/#post-8523252)
 * [@yithemes](https://wordpress.org/support/users/yithemes/)
 * Hello dear support
 * The same issue. [@dannykater](https://wordpress.org/support/users/dannykater/)–
   proposed temporary solution which is not work in my case.
 * I use Dash Theme + WC Vendors Pro plugin + YITH WooCommerce Ajax Product Filter.
 * > When YITH Product Filter plugin is activated, on adding a product (edit-product.
   > php) below Array is parsed into the urlencode() function from formatting line
   > 4695 and causes below error:
   > Warning: urlencode() expects parameter 1 to be string, array given in /homepages/
   > 10/d622714196/htdocs/clickandbuilds/OoOCAZ/wp-includes/formatting.php on line
   > 4695
 * Are you going to solve the issue or i should find another solution independent
   of you?
 *  [localbrands](https://wordpress.org/support/users/localbrands/)
 * (@localbrands)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/bug-array-parsed-into-urlencode/#post-8523643)
 * Added
 * It appears if add Attributes, or add Categories
 *  Thread Starter [dannykater](https://wordpress.org/support/users/dannykater/)
 * (@dannykater)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/bug-array-parsed-into-urlencode/#post-8523926)
 * [@localbrands](https://wordpress.org/support/users/localbrands/), just to clearify:
 * You have to replace from
 * `function wp_basename( $path, $suffix = '' ) {`
 * to
 *     ```
       return urldecode( basename( str_replace( array( '%2F', '%5C' ), '/', urlencode( $path ) ), $suffix ) );
       }
       ```
   
 * with
 *     ```
       function wp_basename( $path, $suffix = '' ) {
       	$array = $path;
       	$can_foreach = is_array($array) || is_object($array);
       	if ($can_foreach) {
       		foreach ($array as $single_path){
       			$path = $single_path;
       		}
       	}
       	return urldecode( basename( str_replace( array( '%2F', '%5C' ), '/', urlencode( $path ) ), $suffix ) );
       }
       ```
   
 * Please let me know if this works for you.
 * And same question to YITH from me. I see you’ve done an update? Is this solved
   in this update?

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

The topic ‘Bug Array parsed into urlencode()’ is closed to new replies.

 * ![](https://ps.w.org/yith-woocommerce-ajax-navigation/assets/icon-256x256.gif?
   rev=3129944)
 * [YITH WooCommerce Ajax Product Filter](https://wordpress.org/plugins/yith-woocommerce-ajax-navigation/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/yith-woocommerce-ajax-navigation/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/yith-woocommerce-ajax-navigation/)
 * [Active Topics](https://wordpress.org/support/plugin/yith-woocommerce-ajax-navigation/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/yith-woocommerce-ajax-navigation/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/yith-woocommerce-ajax-navigation/reviews/)

 * 7 replies
 * 4 participants
 * Last reply from: [dannykater](https://wordpress.org/support/users/dannykater/)
 * Last activity: [9 years, 6 months ago](https://wordpress.org/support/topic/bug-array-parsed-into-urlencode/#post-8523926)
 * Status: not resolved