Is there a coding doc or tutorial to create a SEARCH where it search post in all Blogs in WPMU that will place in WPMU primary site SEARCH?
Leave a Reply
You must be logged in to post a comment.
Is there a coding doc or tutorial to create a SEARCH where it search post in all Blogs in WPMU that will place in WPMU primary site SEARCH?
You must be logged in to post a comment.
Take a look at WPMU Global Search plugin which can easily search through all blogs into your WordPress MU posts by post title, post content or post author.
and if you are not looking for a plugin then just take a look at the code and see how it’s done.
The best approach is to create a “must-use” plugin that gathers post data when a post is submitted on any blog, and store it into a custom database table on the primary blog (and eventually delete it when a post is deleted).
For example hook a function on
save_post
that gets the post permalink, title, content or tags, number of comments, blog id, post id and stores them into a row of your custom table.When someone does a search you pull out information from this table, instead of querying dozens of blogs.
You could use plugins like the one mentioned above, but these are not very good for larger sites. For example, I get around 10K queries using 1GB memory with “multisite-global-search” and that’s just for a setup of 20 blogs with ~3000 posts. Needles to say it took 30 seconds to complete…
I use google search with adsense. That works great if you setup the search to only search your domain. It will search all subdomains to
https://www.google.com/adsense
Note: It will only find pages indexed by google. So you must wait for a while until newest posts appear there.