Title: problem with urlencode warning
Last modified: November 7, 2018

---

# problem with urlencode warning

 *  Resolved [Mostafa Shahiri](https://wordpress.org/support/users/mostafadeveloper/)
 * (@mostafadeveloper)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/problem-with-urlencode-warning/)
 * Hi
 * I am creating a Woocommerce plugin that displays products with some details in
   a widget and it loads more products by using AJAX. All parameters and attributes
   of the products are loaded correctly, but I receive an unknown warning message:
 * urlencode() expects parameter 1 to be string, array given in wp-includes\formatting.
   php on line 4790
 * I don’t know why this message is created. I placed main function that fetches
   data from database in a class in a separated file. The name of this file is a
   something like class.pluginname-helper.php. I supposed this problem is related
   to the name of this file, so I tried to change name of this file, but it did 
   not solve the problem. please help me.
    -  This topic was modified 7 years, 6 months ago by [Mostafa Shahiri](https://wordpress.org/support/users/mostafadeveloper/).
    -  This topic was modified 7 years, 6 months ago by [Mostafa Shahiri](https://wordpress.org/support/users/mostafadeveloper/).

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

 *  [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * (@catacaustic)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/problem-with-urlencode-warning/#post-10858286)
 * That error will come from _somewhere_ in your code. Finding it could be hard 
   because there’s a good chance that it’s called somwhere along a very long train
   of functions calls.
 * You need to do some debugging, so I’d suggest working thorugh your plugins code
   and seeing what you can comment out to temporarily disable it until you find 
   out wich part is causing that error, then look into that code more to find out
   what’s happening. It won’t be a quick process, bot that’s what you need to do.
    -  This reply was modified 7 years, 6 months ago by [catacaustic](https://wordpress.org/support/users/catacaustic/).
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/problem-with-urlencode-warning/#post-10858476)
 * Obviously something is passing an array instead of a string. Sometimes that’s
   enough of a clue. catacaustic’s comment out approach is a classic, tried and 
   true approach. It’s also extremely tedious. I suggest setting the error handler
   of PHP to output a back trace so you have a better idea of the root cause. For
   example:
    [https://stackoverflow.com/questions/1159216/how-can-i-get-php-to-produce-a-backtrace-upon-errors/1159235#1159235](https://stackoverflow.com/questions/1159216/how-can-i-get-php-to-produce-a-backtrace-upon-errors/1159235#1159235)
 * The output can still be confusing or even useless, but it’s often good information.
 *  Thread Starter [Mostafa Shahiri](https://wordpress.org/support/users/mostafadeveloper/)
 * (@mostafadeveloper)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/problem-with-urlencode-warning/#post-10859058)
 * Thank you for your guidance. I hadn’t used tax_query in my code. When I changed
   my code by using tax_query, the problem was solved.

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

The topic ‘problem with urlencode warning’ is closed to new replies.

## Tags

 * [file name](https://wordpress.org/support/topic-tag/file-name/)
 * [formatting](https://wordpress.org/support/topic-tag/formatting/)
 * [urlencode](https://wordpress.org/support/topic-tag/urlencode/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 3 replies
 * 3 participants
 * Last reply from: [Mostafa Shahiri](https://wordpress.org/support/users/mostafadeveloper/)
 * Last activity: [7 years, 6 months ago](https://wordpress.org/support/topic/problem-with-urlencode-warning/#post-10859058)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
