Widget Logic
Error: Warning in_array function in array Wrong datatype (3 posts)

  1. leviticus
    Posted 4 years ago #

    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?


  2. alanft
    Plugin Author

    Posted 4 years ago #

    "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.

  3. leviticus
    Posted 4 years ago #

    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. :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic