A few days ago in WordPress job list came a request for WordPress MU site wide search plugin. Out of interest I googled string:
wordpress mu search plugin
To tell the truth: I was surprised. It returned only two decent results:
Decided to test them. On a local server made a clean WordPress MU install (With subdomains). Used default WordPress theme.
One Search WPMU Plugin
Downloaded and installed the first one. Sadly, no configuration panel from administration interface. The documentation said, I need to create a new blog to get it to work. Made it. Tried search results. Nothing. Install documentation says nothing, readme file too. Went to plugin page.
Well, Sadly: nothing more. Just a ton of questions how to get it working. Checked some variants, made sure that all requirements are met: nothing. At that time I decided to try other variant as this one, even if possibly working variant: it’s definitely not user friendly.
Downloaded other variant. Made all the steps needed and, what do you know: it works! Here is a detailed installation procedure:
- Download files to your system: Download wpSearchMu.
- Get wp-search-mu folder and wp-search-mu.php file out of it, put them in your mu-plugins folder.
- Change chmod for wp-search-mu folder to 777 (If don’t know how to do that, your ftp software should be able to do that. Try right clicking on the folder, look for “change permissions” or something like that)
- Go to your theme search.php file, change it to something like this (taken from default WordPress theme)
<?php while (have_posts()) : the_post(); ?>
<?php switch_to_blog($post->blog_id); ?>
<div <?php post_class() ?>>
<h3 id=”post-<?php the_ID(); ?>”><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></a></h3>
<small><?php the_time(‘l, F jS, Y’) ?></small>
<p><?php the_tags(‘Tags: ‘, ‘, ‘, ‘<br />’); ?> Posted in <?php the_category(‘, ‘) ?> | <?php edit_post_link(‘Edit’, ”, ‘ | ‘); ?> <?php comments_popup_link(‘No Comments »’, ‘1 Comment »’, ‘% Comments »’); ?></p>
<?php restore_current_blog(); ?>
<?php endwhile; ?>
Note the code in red – you need to add it. Searching will work without this modification, sadly, the links it will return will all lead to the one blog who is doing the search: they won’t be correct.
- Then go to Settings => WP Search Mu part in your administration interface, check Build Search Index and save changes. It will create the index for work as well as index your existing data. You won’t need to do that again as it gets updated automatically whenever you (or someone else updates their blog).