Search WordPress Site Externally

Here’s a quick tutorial on how to perform searches against your WordPress site from another site.

To begin, add the following somewhere on your site’s page (borrowed from WordPress site):

<div id="search">
    <form role="search" method="post" id="searchform" class="searchform" action="<BLOG_SITE_URL>" onsubmit="this.target='search_results'">
        <div>
            <input type="text" value="" name="s" id="s" autocomplete="off">
            <input type="submit" id="searchsubmit" value="Search">
        </div>
    </form>
</div>
<p style="padding-bottom: 50px;"><p>

Where <BLOG_SITE_URL> is the URL to your WordPress site.

The onsubmit call opens the results in a new window (or tab depending on browser) named search_results. You could use _blank, but that would result in a new window every time, using a specific name uses the same window.

End result from above:

Example use:

And that’s all I have to say about that.

This entry was posted in Geek, Programming, WordPress and tagged , , , . Bookmark the permalink.

Leave a Reply