Title: Custom Search Function for plugin update
Last modified: August 21, 2016

---

# Custom Search Function for plugin update

 *  Resolved [onerock](https://wordpress.org/support/users/onerock/)
 * (@onerock)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/custom-search-function-for-plugin-update/)
 * I am relatively new to WordPress and have never coded a plugin. I thought that
   this would be a great place to get my feet wet. 🙂
 * I am working to update the “NextGEN Gallery Search” plugin ([http://wordpress.org/plugins/nextgen-gallery-search/](http://wordpress.org/plugins/nextgen-gallery-search/))
   that appears to have been abandoned since it has not been updated in over 2 years
   and the authors website is gone. It allows you to find the gallery you are looking
   for without browsing all the admin galleries pages.
 * NextGen Gallery 2.0 is currently in beta and this plugin doesn’t work any longer.
   I rely on the functionality of this plugin, so I have corrected most everything.
   I am getting stuck with the search portion of it.
 * The plugin has the following code
 *     ```
       <form method="post" action="<?=$_SERVER['REQUEST_URI']?>">
       <table class="form-table" style="width:570px;">
       <tr valign="top">
       <th scope="row"><label for="ngs2_filter">Search Keyword</label></th>
       <td><input name="ngs2_filter" type="text" id="ngs2_filter" value="<?=$_POST['ngs2_filter'];?>" class="regular-text" /></td>
       <td><input type="submit" name="Submit" class="button-primary" value="Search" /></td>
       </tr>
       </table>
       </form>
       $gallerylist = ngs2_search_galleries($_POST['ngs2_filter']);
       ```
   
 * With the code above, when you visit the admin page `<?=$_POST['ngs2_filter'];?
   >` appears in the search box. If you attempt a search, you receive a “404 Not
   found” with the address bar showing “192.168.0.105/wp-admin/<?=$_SERVER[‘REQUEST_URI’]?
   >”
 * I have attempted to follow the WordPress Codex ([http://codex.wordpress.org/Function_Reference/get_search_form](http://codex.wordpress.org/Function_Reference/get_search_form)),
   but it doesn’t explain the various varialbe the plugin seems to use.
 * Can someone please advise me on what might be the issue with the above code or
   point me in the direction of information that will further explain how to fix
   this?
 * I am unable to post a link as it is on a dev server without inbound service.
 * The function works correctly on WordPress version 3.5.2 and current version 1.9.13
   of Nextgen Gallery.
 * Thanks so much in advance
    Scott

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/custom-search-function-for-plugin-update/#post-3929896)
 * Change the 2 occurrences of “`<?=`” to “`<?php` “. It appears the file got slightly
   corrupted for some reason.
 * There should also be a “`<?php`” between `</form>` and the `$gallerylist` line,
   though the original file does have this, you apparently have done other editing.
   Be careful that all tags balance when you edit and that PHP blocks are always
   separated from HTML content.
 *  Thread Starter [onerock](https://wordpress.org/support/users/onerock/)
 * (@onerock)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/custom-search-function-for-plugin-update/#post-3929927)
 * Thank You, Thank You, Thank You!!
 * “<?=” was the problem. Strangely enough, my working source code uses “<?=”. I
   incorrectly assumed that this was coding that I didn’t understand.
 * You are correct, I condensed the code above to only the pertinent form information
   where I thought the issue was.
 * Is there a good source of information explaining forms and how it is being used
   in this plugin? I could only find what was in the Codex, but that seemed to pertain
   to only searching for blog posts.
 * Thanks again for your help!
    Scott
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/custom-search-function-for-plugin-update/#post-3929960)
 * There’s plenty on generic HTML forms, such as [W3 Schools](http://www.w3schools.com/html/html_forms.asp).
   But as it pertains to the plugin? Very unlikely. All one could do is examine 
   the source code, but one needs to understand PHP to do that.
 * The PHP portions of this form are populating the fields with values from another
   form that was just submitted to get this form. As for what happens when this 
   form is submitted, I’ve no idea, I didn’t look any further than to confirm those
   were the only typos of that nature.
 *  Thread Starter [onerock](https://wordpress.org/support/users/onerock/)
 * (@onerock)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/custom-search-function-for-plugin-update/#post-3929972)
 * Thanks again for your help. Now that I know this form is driven by PHP and not
   a WordPress function, I will begin to see what I can learn about PHP.
 * Those typos were the source of the issues and resolved the problem I was experiencing.
 * Scott

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Custom Search Function for plugin update’ is closed to new replies.

## Tags

 * [search form](https://wordpress.org/support/topic-tag/search-form/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 4 replies
 * 2 participants
 * Last reply from: [onerock](https://wordpress.org/support/users/onerock/)
 * Last activity: [12 years, 11 months ago](https://wordpress.org/support/topic/custom-search-function-for-plugin-update/#post-3929972)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
