Re is out: see what's new Lifetime updates on every purchase Support replies within 24 hours Secure checkout via Gumroad 8,500+ sales since 2016

Suggested answers

Updated 3 min read 6 views

The Suggested answers add-on shows articles that may answer a question while visitors type it in your form. If one does, they don’t need to write, and fewer questions reach your inbox.

Articles come from this site (posts, pages, a docs post type, any public kind) or from another WordPress site, such as your docs on their own domain. They show after a short pause in typing: where the form’s Suggested answers field is, or, without one, under the last field it looks in.

Place them yourself: in the form editor, click More → Suggested answers and drag its chip where the articles should show, such as above the message or next to the send button. It takes no room until there are articles to show, and it’s never sent.

Set it up

  1. Open a form, then its Suggested answers tab.
  2. Under Look for answers to what they type in, tick the fields, usually the subject and the message.
  3. Pick Articles from: This site, with the kinds of posts, or Another WordPress site, with its address.

The form’s Suggested answers tab

SettingWhat it does
Look for answers to what they type inThe text fields it reads. Nothing ticked: no suggestions on this form.
Articles fromThis site, or another WordPress site with its REST API open (it is by default).
Of these kindsThis site’s public post types to search. Posts and pages at first.
Address of that siteThe other site’s home page, such as https://docs.example.com.
Heading above themThe line over the list. Empty: no heading.
Articles at mostFrom 1 to 8. 4 at first.
Say in the mail which articles they sawOn at first. See below.

How articles are found

WordPress’s search wants every word in one post, so a whole sentence finds nothing. Suggested answers keeps the telling words of what was typed (no “how”, “please” or “the”, 3 letters or more), looks each one up, and puts first the articles that hold the most of them; a word in the title counts twice. Another site’s answers are kept for six hours, so typing the same thing again asks it nothing.

A visitor can search 60 times in ten minutes, so the search can’t be used to load your server.

What you get in the mail

Someone who writes anyway saw articles that didn’t answer: worth a look. With Say in the mail which articles they saw on, the list goes at the end of the mail, in the entry and in the webhooks (as suggested_answers: title, url, opened), and articles they clicked say (opened). Put [_suggested_answers] in the mail to have it somewhere else.

Change how it looks

Two templates, each copied to your theme to change it:

  • fields/answers/default/field.php: the Suggested answers field, the place the articles show. Keep its data-remaily-answers-box: the script fills that box.
  • suggested-answers/list.php: the list itself, styled by suggested-answers/style.css in your form’s colors. Keep data-remaily-answer on each link: it’s how the script sees which ones were opened.

Copy them to your-theme/remaily/ under the same paths.

For developers

HookWhat it does
remaily_suggested_answersThe articles found: ( $found, $text, $settings ), each [ 'title', 'url', 'excerpt' ]. Reorder them, add your own, or return none.
remaily_suggested_answers_stopwordsWords left out of the search, lowercase. Add your site’s language.
Was this article helpful?