WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Wondering if there's a way to edit our search.php or .htaccess or function.php (or anything else...) so that our search function on our main site (www.oursite.com) includes the subdomain of blog.ourwebsite.com?

Any thoughts or suggestions are appreciated it..

share|improve this question
Your search function would have to access WordPress's database, which certainly is possible, but I don't think I can give real answer without more information. – s_ha_dum Feb 1 '13 at 21:42
Thank you for your input - what sort of information would you need? I believe there are currently two wordpress databases set up (done by someone else) - one for the main site, one for the blog. I do have the database name/users/pw for both if needed? – E P Feb 4 '13 at 19:36
Are both sites WordPress? What does search.php look like? How good are you at SQL and PHP? – s_ha_dum Feb 4 '13 at 19:39
Yes - both sites are Wordpress. – E P Feb 4 '13 at 21:02
Please put code in your question, not as download/zip on an external resource. – kaiser Feb 18 '14 at 3:46

If you transform your main website's Wordpress into a multi-site environment, you can move blog.yourdomain.com to be a network site.

Once you do this, you could use the Multisite Global Search plugin to add a widget that searches all network sites.

It would be easy to move your standalone blog.yourwebsite.com to a network site:

  1. export the content from blog.yourdomain.com,
  2. create a subdomain Wordpress network on your main website,
  3. edit your blog.subdomain.com settings (Settings > General) to change the site and Wordpress URL to blog2.subdomain.com,
  4. rename your subdomain blog to blog2 in cPanel,
  5. create a network site called blog.yourdomain.com
  6. import the content you exported earlier.


PS - You'd need to copy any themes and plugins you have on blog2.yourdomain.com into the main Wordpress installation.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.