Source – Gravity Forms

Current version: 0.0.3 View Changelog

Download available with active license

Table of Contents

Gravity Forms is a premier forms plugin for WordPress. It is immensely popular and even more capable. This Extension allows you to use Gravity Forms form entries as a custom Source for SearchWP, making it possible to search Gravity Forms Entries with SearchWP!

Adding Gravity Forms Entries to SearchWP’s Index

Once SearchWP Source – Gravity Forms has been installed and activated, your Gravity Forms will appear in the Sources list for your SearchWP Engine.

Note: This custom Source can be used only with a Supplemental Engine.

Let’s say you were building a feature request area on your website and using Gravity Forms to collect entries.

Screenshot of Gravity Forms setup

You could utilize SearchWP to allow customers to first search existing entries before submitting their own, so they could join in up-voting the existing submission instead of creating a duplicate.

The first step would be to create a new Supplemental Engine that has our Feature Request Form as the Source:

Adding Gravity Form to SearchWP

With the form chosen (note that you can combine entries from multiple Gravity Forms into a single Engine if you’d like!) you can pick and choose which field(s) you’d like to consider for searching:

Adding Gravity Forms attributes to SearchWP

SearchWP allows you to search the entire Gravity Forms Entry as a whole, optionally consider any Notes that have been added, or choose exactly which field(s) should be considered when searching, each with its own relevancy weight!

Displaying Gravity Forms Entries as Results

The SearchWP Source – Gravity Forms Extension will make available Gravity Forms Entries as search results. This integrates as any Source would when working with a Supplemental Engine.

Unlike a native WordPress search that has The Loop which is an array of WP_Post objects that WordPress’ API interacts with, the results set for a Supplemental Engine can be made up of any SearchWP Source object.

Gravity Forms does not have a proper object for Form Entries, each Entry is an array of key value pairs. As a convenience, SearchWP Source – Gravity Forms will return results in a wrapper object:


This will help as you iterate over your results array:

$searchwp = new \SearchWP\Query( 'marketing', [
'engine' => 'gravity',
'fields' => 'all',
] );
foreach ( $searchwp->results as $result ) {
switch ( get_class( $result ) ) {
case 'SearchWP\Sources\GravityForms\Entry':
// NOTE: Gravity Forms Field values are keyed by the Field ID in the Form editor.
<div class="result">
Form ID: <?php echo esc_html( $result->id ); ?><br>
Name: <?php echo esc_html( $result->{'1'} ); ?><br>
Email: <?php echo esc_html( $result->{'2'} ); ?><br>
Type: <?php echo esc_html( $result->{'3'} ); ?><br>
Feature: <?php echo esc_html( $result->{'4'} ); ?>
// Another Source was added to the SearchWP Engine.
print_r( $result );
view raw page.php hosted with ❤ by GitHub

Note: You can prevent SearchWP from wrapping results in the class with the following hook:

add_filter( 'searchwp\source\gravity_forms\entry\raw', '__return_true' );

SearchWP Source – Gravity Forms allows you to make any Gravity Forms Entry searchable using SearchWP! You can make as many SearchWP Engines with as many Gravity Forms Sources as you’d like, each with their own configuration of Fields and/or Notes. Use SearchWP’s capable search algorithm to make your Gravity Forms Entries searchable!



  • [Fix] PHP error if form entry is omitted.


  • [Fix] Error on activation
  • [Update] Updated updater

Want to make your search awesome right now?

More than 30,000 sites have chosen SearchWP!

You can utilize all of the content that’s gone unrecognized by native WordPress keyword search instantly with SearchWP.

Get SearchWP for just $99

  • Committed Support
    If you need help, support is fast, friendly, and here for you
  • Streamlined Setup
    Installation and setup that’s optimized for speed
  • Great Documentation
    Helpful, clear, and usable documentation is a priority

See what SearchWP customers have to say

  • “we use searchwp on numerous projects, as it is a well coded plugin that extends wordpress on vital functions for data-heavy websites.”

  • “I had some difficulties to get different results if users are logged in or not. Support was more than code snippets. Complete functions were sent to add in the function.php of my child theme. Very competent and very friendly support! -Henner”

  • “I’ve used SearchWP for years. Recently I had a problem getting SearchWP to index on new hosting. After other troubleshooting, Jonathan cloned my site and confirmed that the problem was not the site. I moved to new hosting and it indexed.”