• I used to use this plugin in the past but there was a compatibility issue with another plugin that was more important then. That’s changed, so I’m trying to bring this back.

    When I activate the plugin and configure it, an error appears where the post listing should be:

    Warning: array_diff(): Argument #1 is not an array in /var/www/mydomain.net/html/wp-content/plugins/where-did-they-go-from-here/where-did-they-go-from-here.php on line 68

    If you google that error message, you’ll see a few other blogs that have it appearing.

    https://wordpress.org/plugins/where-did-they-go-from-here/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Ajay

    (@ajay)

    Could you please replace lines 66 to 68 with this:

    $results = get_post_meta($post->ID, 'wheredidtheycomefrom', false);
    
    if ( ! empty( $results ) ) {
        $results = array_diff($results, array_map ('intval', explode(',', $wherego_settings['exclude_post_ids']) ) );
    }
    Thread Starter jshare

    (@jshare)

    How I tested this-

    I found a post with the error appearing, made the code change and refreshed the page. The error disappeared but the only result that appears was a link to that post itself, which doesn’t make any sense. In other words, the plugin was saying that ‘people also visited’ post X, and this was appearing *on post X*.

    I visited some other posts and couldn’t see the error anywhere, but all the articles I visited only had one result and it was either self-referential or it was the first post ever in the archive (Hello World!)

    Plugin Author Ajay

    (@ajay)

    Can you tell me how you found the array_diff error. I mean how did you test / reproduce the existing error without the code changes.

    I don’t see this error on my blogs, but obviously there is an issue I’d like to replicate and fix.

    Thread Starter jshare

    (@jshare)

    Before the patch you sent, the error wasn’t appearing on every post. The question is on which posts was it appearing i.e. what did those posts have in common? After taking another look, it looks like the error appears on articles that no one has left from i.e. the plugin has no results to display. In all the articles where the error displays, my choice for ‘When there are no posts, what should be shown?’ is displayed.

    One thing worth mentioning is that I’m on multisite.

    Plugin Author Ajay

    (@ajay)

    Thanks for the explanation. I’ll try to see how I can replicate this.
    Is this a PHP error that is displayed directly in the post? Or is this something in the error_log?

    It could also be a problem for multisite because I haven’t tested the plugin on multisite.

    Thread Starter jshare

    (@jshare)

    This is a PHP error that is displayed directly in the post.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘array_diff error’ is closed to new replies.