Looping through tables (5 posts)

  1. Ryan Kanner
    Posted 1 year ago #

    I have a large multisite install (500+ sites) and I am trying to figure out the best way to loop through all of the tables to select the value of a certain option name. I would like to do this purely in SQL.

    use case example for single site:

    SELECT option_value FROM wp_options WHERE option_name = 'blogname'

    I would like to be able to do this for all 500 sites at once to return a list of all of the blog names.

  2. Ryan Kanner
    Posted 1 year ago #

    yeah, I need to do this in pure SQL.

  3. Okay, you changed from 'I would like to...' to 'I need to...'

    May I ask why?

  4. Elio Rivero
    Posted 1 year ago #

    Hi Ryan, please disregard that link Ipstenu posted since it uses the function get_blog_list that was deprecated in WP version 3.0.

    Instead, use wp_get_sites introduced in WP 3.7


Topic Closed

This topic has been closed to new replies.

About this Topic