Title: [Plugin: Widget Logic] Error: Warning in_array function in array Wrong datatype
Last modified: August 20, 2016

---

# [Plugin: Widget Logic] Error: Warning in_array function in array Wrong datatype

 *  [leviticus](https://wordpress.org/support/users/leviticus/)
 * (@leviticus)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-widget-logic-error-warning-in_array-function-in-array-wrong-datatype/)
 * I am getting the following error from the widget logic plugin, that repeats over
   and over on my site when the plugin is activated:
 * >  Warning: in_array() [function.in-array]: Wrong datatype for second argument
   > in /public_html/wp-content/plugins/widget-logic/widget_logic.php(169) : eval()’
   > d code on line 1
 * I would give you the link, but I had to disable the plugin to make the website
   work.
 * The plugin was working perfectly before and I am updated the current version 
   of the plugin. I believe the problem may have started after the latest WP update,
   but I’m not sure of that.
 * Any thoughts?
 * [http://wordpress.org/extend/plugins/widget-logic/](http://wordpress.org/extend/plugins/widget-logic/)

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

 *  [alanft](https://wordpress.org/support/users/alanft/)
 * (@alanft)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-widget-logic-error-warning-in_array-function-in-array-wrong-datatype/#post-2592404)
 * “eval()’d code on line 1”
 * tells us that the problem is in some of the widget logic in one or more of your
   widgets – something that uses in_array or a function that uses it. in this case
   it’s saying that the second parameter isn’t an array. have a check through your
   widgets for in_array statements. if you can’t see any, try copying a widget’s
   logic somewhere for safe keeping, blanking it and saving. try each widget in 
   turn, and so on.
 * I might try adding code to trap errors and giving clearer feedback somehow.
 *  Thread Starter [leviticus](https://wordpress.org/support/users/leviticus/)
 * (@leviticus)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-widget-logic-error-warning-in_array-function-in-array-wrong-datatype/#post-2592522)
 * Thanks for the suggestion. I cleared the widget logic from the widgets and the
   error messages disapeared. After some digging, I found the error was in the $
   post->ancestors call.
 *     ```
       global $post; return ( is_page('businesses') || $post->post_parent == '24' || in_array( '24', $post->ancestors) );
       ```
   
 * I changed it to
 *     ```
       global $post; return ( is_page('businesses') || $post->post_parent == '24' || in_array( 24, get_post_ancestors($post)) );
       ```
   
 * and it worked again. 🙂

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

The topic ‘[Plugin: Widget Logic] Error: Warning in_array function in array Wrong
datatype’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/widget-logic_c8dde5.svg)
 * [Widget Logic](https://wordpress.org/plugins/widget-logic/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/widget-logic/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/widget-logic/)
 * [Active Topics](https://wordpress.org/support/plugin/widget-logic/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/widget-logic/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/widget-logic/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [leviticus](https://wordpress.org/support/users/leviticus/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-widget-logic-error-warning-in_array-function-in-array-wrong-datatype/#post-2592522)
 * Status: not resolved