• Hi,
    I have recently encountered an issue with a piece of code:

            if ( isset( $post->blog_id ) ) {
                    switch_to_blog( $post->blog_id );
            }
    

    It throws an error. While tracking it I found in the top ten plugin:

                $blog_id          = get_current_blog_id();
    

    I think it is where the issue might be. Can you please check if the blog_id has to be set? It is breaking the relevanssi plugin at the moment.

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

    (@ajay)

    Sorry for the delay. I’ll take a look at this. I’m working on an update of the plugin.

    But, can you tell me which lines in which files are these and what eror you are seeing?

    Thread Starter Grzegorz.Janoszka

    (@grzegorzjanoszka)

    Hi, it is top-10/includes/tracker.php line 48. It sets the variable $blog_id. As the variable is not defined earlier as local, I think the global one of wordpress $blog_id is used. And in single-site installations the variable is not set.

    The code that I quoted earlier checks is_set($blog_id) as a detection whether it is a multisite setup or not. With top10 plugin it fails later on on function switch_to_blog. It maybe is not the best way of detecting multisite install, but I guess it is used by at least some developers.

    I guess the solution would be to rename your variable blog_id to something else, that doesn’t collide with WP global variable.

    Thank you for looking into it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘blog_id set on single site installation’ is closed to new replies.