WordPress.org

Ready to get started?Download WordPress

Forums

Widget Logic
[resolved] Warning: in_array() [function.in-array]: Wrong datatype for second argument (6 posts)

  1. leviticus
    Member
    Posted 1 year ago #

    Just upgraded WordPress to 3.5 and now receiving the following warning on my site:

    Warning: in_array() [function.in-array]: Wrong datatype for second argument ... /public_html/wp-content/plugins/widget-logic/widget_logic.php(270) : eval()'d code on line 1

    Will a fix/update to the plugin be coming soon to resolve the error? Or is there something I can do on this end?

    http://wordpress.org/extend/plugins/widget-logic/

  2. alanft
    Member
    Plugin Author

    Posted 1 year ago #

    the error suggests the problem is in one of the bits of widget logic in one of your widgets. (line 270 is the bit that executes your given WL code)

    But you could try the DEV version which I have updated to work with 3.5

  3. alanft
    Member
    Plugin Author

    Posted 1 year ago #

    never mind, I've committed 0.54 now. but you still may need to comb through your WL

  4. leviticus
    Member
    Posted 1 year ago #

    Thanks for your quick reply alanft. I upgraded to 0.55 and still had the error, so I went through my WL and I think it was having trouble with the way I was trying to get ancestors of a page:
    global $post; return ( is_page('community') || $post->post_parent == '15' || in_array( 15, get_post_ancestors($post)) );
    I changed it to a is_tree function found here http://wordpress.org/support/topic/is_tree-function but that created a different error:
    'Warning: Invalid argument supplied for foreach() in .../wp-content/themes/rutland-theme/functions.php on line 26'
    which is
    'foreach($anc as $ancestor) {'
    Do you know the best WL to show a widget on children and grandchildren of a specific page ID?

  5. alanft
    Member
    Plugin Author

    Posted 1 year ago #

    there's another thread with someone having trouble with get_post_ancestors - I'll have a look at that to see if there's some substantial change in WP3.5

    hard to say what's up with your is_tree function (as that page doesn't have any code with foreach in it)

    i will take a look at get_post_ancestors

  6. alanft
    Member
    Plugin Author

    Posted 1 year ago #

    Yep, looking at 3.4 v 3.5, get_post_ancestors was re-written and now can return FALSE, so any

    in_array(n, get_post_ancestors($post))

    conditionals have to be written with a bit more caution testing $post first, something like

    ($post) && in_array(n, get_post_ancestors($post))

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.