Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4620008
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:30:07+00:00 2026-05-22T02:30:07+00:00

The search plugin I’m using in WordPress, (Relavenssi), allows the user to add quotes

  • 0

The search plugin I’m using in WordPress, (Relavenssi), allows the user to add quotes to search terms in order to search for phrases, for example “search phrase”.

How would I code it so that when the user selects a radio/check box called ‘Exact Match’, the quotes are automatically added to the search query rather than being added into the search box by the user?

Any help greatly appreciated, S.

Search form code below:

                  <form action="<?php bloginfo('home'); ?>/" method="post">
                  <div class="search-icon">     
                      <label for="search" accesskey="4" class="hidden">Search the site</label>                 
                      <input type="text" name="s" id="search" value="Enter search term" onblur="this.value = this.value || this.defaultValue;" onfocus="this.value = '';" />                
                      <input type="submit" name="submit" value="GO" class="s-btn" />
                      <p><a href="#" id="search-anchor">Search Options</a></p>
                      <div class="option-slide">
                      <input type="radio" name="sentence" value="" checked="checked" /><label>All Words</label><br />                          
                      <input type="radio" name="sentence" value="???" /><label>Exact Match</label>  
                      </div>   
                  </div>
              </form>      

Edit: Based on the answer from @Tristar Web Design below, I have now added this php code below my search form, although it doesn’t work properly. It echoes out ok but isn’t passing the query back. How do I pass/send the updated search query back to WordPress?

                if(isset($_POST['s']) && $_POST['sentence'] == 'exact') {
                    $_POST['s'] = '"'.get_search_query().'"';
                    echo $_POST['s'];
                } else {
                    echo "2";
                }   
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:30:07+00:00Added an answer on May 22, 2026 at 2:30 am

    A couple of methods for this I guess.

    1. Use PHP and make it prepend and append quotes to the search value if exact match is selected.
    2. Use Javascript and make it prepend and append quotes inside the field onclick, so the value that is sent has quotes applied to it. I’d probably try this javascript method!

    Edit:

    Maybe consider this jQuery method (This method assumes that jQuery has been loaded, and I also added my own noConflict() variable) –

    <script type="text/javascript">
        var $j = jQuery.noConflict();
    
        function addquo() {
        if($j('#s').val()) {
        var text = '"'+ $j('#s').val() +'"';
                $j('#s').val(text);
        }
        }
    
        function removequo() {
        if($j('#s').val()) {
    
        var txt = $j('#s').val();
                $j('#s').val(txt.replace(/"/g, ''));
    
        }
        }
    
    </script>
    
    <form action="/" id="searchform" method="get" role="search">
    <div><label for="s" class="screen-reader-text">Search for:</label>
    <input type="text" id="s" name="s" value="">
    <input type="submit" value="Search" id="searchsubmit">
    <input type="radio" name="sentence" value="" onclick="javascript:addquo();" /><label>All Words</label><br />
    <input type="radio" name="sentence" value="???" checked="checked" onclick="javascript:removequo();" /><label>Exact Match</label>
    </div>
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my search for a good glossary plugin for WordPress, I came across Natan
I am using jQuery's auto-complete plugin for a simple search form. I am having
I am using the jQuery DataTables plugin. I would like to move the search
So I am using bhedana's google_maps plugin and have built a search for points
I'm trying to add my plugin to the WordPress Repository so that users can
I use the jQuery Autocomplete plugin to display user info in the search box
I am using Sphinx with the Thinking Sphinx plugin to search my data. I
I'm using CakePHP 1.3.8, and I've installed the CakeDC Search plugin . I have
I've used Wordpress's plugin that notifies a few search engines every time you make
I'm using the jqGrid plugin along with its 'advanced search' feature. Is there a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.