WordPress Search on Multiple wp sites

You’ll need to have a look at the posts_clauses filter. There’re more specialised filters as well like posts_where, but you’ll finally end up using the all in one filter.

Then you can inspect the outcome using the 'posts_selection' hook right below that, or the posts_results filter a bit later on.

There’s as well the posts_search filter as searches use a bit different SQL strings.

The final result can be inspected using $wpdb->last_query, or in case of an error using $wpdb->last_error.

If a user is logged in and should be able to search all the blogs he’s registered to, get_blogs_of_user() might be an option. Retrieving a general list of all blogs isn’t hard as well.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)