# Saved Search Queries

## Automatically Importing Posts Based on a Saved Search Query

You can save search queries to make it easier to view results and import new content in the future.

Optionally, when saving or editing a search query, you can specify that new search results be automatically imported. For search results that are automatically imported, the PMP plugin can either:

- Create draft posts from results for the saved query
- Publish posts from results for the saved query

Note: the default behavior for saved search queries is to do nothing with search results.

## Saving a Search Query

Start by visiting the **Public Media Platform** > **Search** link in the WordPress dashboard as you would to [search for content](#pull-content-from-the-pmp).

Configure the search form to your liking. For example:

![Saved search query start](/assets/img/search-chicago-pri.png)

Once your have your query configured and are ready to save, click the "Save query" button. A modal window will appear, asking you to specify a title for the saved search query. 

You can specify what action to take with new results for the saved search query whenever it's run: create draft posts for review, publish posts immediately, or do nothing with the results which allows you to select posts from the results for creating drafts or posts.

At this point, you might also like to [auto-assign categories to imported posts](#auto-assign-categories-to-imported-posts).

![Saved search query modal](/assets/img/saving-a-pmp-search.png)

Once you have specified a title and an action, click the "Save" button.


### Auto-assign Categories to Imported Posts

When saving a search query, you also have the opportunity to set categories to be applied to all posts automatically imported for said query.

For example, if you want to construct a search query for "Chicago marketplace" and funnel all posts found for that query to your site's "News" category, you would:

1. Ensure you have a "News" category on your site by navigating to Posts > Categories in the WordPress dashboard.
2. Navigate to Public Media Platform > Search and perform the steps to save a search query [outlined above](#saving-a-search-query).
3. Before clicking the "Save" button to save your query, select the "News" category from the category list in the "Save the current query" dialog.

See:

![Saved search query select categories](/assets/img/saving-news-search.png)

## Viewing and Editing a Search Query

After clicking the "Save" button to save a search query, the page will automatically reload and present you with your newly saved query:

![Saved search query edit](/assets/img/saved-pmp-search.png)

Note the notice above the search form that reads:

    "Viewing saved query: "Chicago (PRI)"

Also note in the location where there was previously a "Save query" button, you are now presented with an "Edit query" button.

Clicking the "Edit query" button allows you to change your preferences for the saved query.

For instance, if you wanted to change the action taken for new results for the saved query to automatically publish, you would:

- Click "Edit query"
- In the modal window that appears, select "Publish posts from results for this query"
- Click the "Save" button

See:

![Saved search query edit modal](/assets/img/edit-news-search.png)

## View All Saved Search Queries

To see all saved search queries, visit the **Public Media Platform > Manage saved search** link in the WordPress dashboard. From there, you see the complete list of saved search queries:

![Manage saved searches list](/assets/img/view-saved-searches.png)

Actions you can take for each saved search query include:

- "View and edit this search query"
- "Delete"

Clicking "View and edit this search query" will land you on the page described in the [Viewing and editing a search query](#viewing-and-editing-a-search-query) section of the documentation.

Clicking "Delete" will present you will a confirmation modal:

![Delete a saved search query](/assets/img/delete-search-dialogue.png)

## All Set

Now you're ready pull great content from the PMP for use on your WordPress site, and push you own fine work to the PMP for others in the public media ecosystem to share with their digital audiences. Do great things!
