Searching wishlists

Search form[nmgr_search_form]nmgr_get_search_form()
Search results[nmgr_search_results]nmgr_get_search_results()

Shortcodes and functions available for searching wishlists

The plugin search form is empowered to search wishlists in the standard wordpress areas such as title and content as well as the wishlist owner’s first name, last name, partner first name, partner last name, and email.

You can make the plugin search in extra meta fields using the filter nmgr_meta_keys_to_search.

The plugin has been designed to make searching wishlists very flexible and convenient for you. It provides a search form, a search results template, and a complete search template page for displaying and outputting the entire search functionality, which can be customized to your use with either the shortcodes or template functions above. For more details on the attributes accepted by the shortcodes and template functions see shortcodes and template functions.

It is likely you would be using shortcodes to search wishlists as most people do, so in this article I will show how the shortcodes can be used to search wishlists on your store. The template functions have however been listed here because they do exactly the same thing as the shortcodes, only directly in code.


This is the simplest shortcode to use for searching wishlists and it simply displays the search form. It comes without any attributes. When this shortcode is used, the form is posted to the home url, just like the default wordpress search, and the search results are displayed by default using the custom search template provided by the plugin.


This shortcode is used to display the wishlist search results. It is only necessary to use it if you want to display the search results anywhere other than the default place where they are displayed. To use this shortcode, the wishlist search form would have to be posted to the location where this shortcode is. This means that the search form would have to be outputted with the [nmgr_search] shortcode instead of [nmgr_search_form] so that you can set the form action. In other words, [nmgr_search_results] should always be used with [nmgr_search] for it to work.

To give an example, let’s say you want to display the wishlist search results at and you want to show the search form at, in the page for the search form,, you would output the shortcode like this:

[nmgr_search show_results=false form_action=]

Notice that we are setting show_results to false because we don’t want the search results to show on this page. We only want the form to show. We are also setting form_action where the form would be posted, to the page where we want the search results to appear. In this page you would then simply add the shortcode:


When you now search for a wishlist at it would take you to to display the results.

Tip: This setup of separating the search form from the search results allows the search functionality to be customized the way you want. The search results can even be displayed in a modal window with this method or dynamically via ajax.


This is the main shortcode for outputting wishlist search functionality and it is the most flexible. It allows you to output either only the search form or the search results, or both. Underneath, it simply combines the results of [nmgr_search_form] and [nmgr_search_results] together and so provides one shortcode for you to use conveniently instead of three.

To show an example of how this shortcode works using our previous illustration, you want to display a search form at and you want to display the search results at, for the search form, as shown before, you would use the shortcode:

[nmgr_search show_results=false form_action=]

And for the search results you would use the shortcode:

[nmgr_search show_form=false]

Notice we are simply telling the shortcode not to show the search form (which it does by default) so that it can only show the search results.

To show both the search form and search results on the same page, simply use:


To show the search form and search results on the same page and show all results when there is no search query on page load, use:

[nmgr_search show_results_if_no_search_query=true]

Modifying the search results title

The default search results title is “Search results for %s” where %s is the search query. This can be easily changed using the general filter for the plugin’s archive results nmgr_archive_title. For example, to change the search results title to “Wishlists matching %s” where %s is the search query, you can use the below code:

add_filter( 'nmgr_archive_title', 'my_nmgr_archive_title' );

function my_nmgr_archive_title( $title ) {
	if ( is_nmgr_search() ) {
		$search_query = get_search_query();
		$title = "Wishlists matching "$search_query"";
	return $title;

Hiding the search results count and page number

The search results count is usually show in the form “%d results found – page 1” where %d is the number of results found. The page number is only shown during pagination if the current page number is available. To hide this text, use the general filter for the plugin’s archive results count nmgr_show_archive_results_count as shown below:

add_filter( 'nmgr_show_archive_results_count', 'my_nmgr_hide_search_results_cout' );

function my_nmgr_hide_search_results_cout( $show ) {
	if ( is_nmgr_search() ) {
		$show = false;
	return $show;