Exclude Link Suggestions

Keep media files and other clutter out of the editor’s link suggestions.

Lauren Gray Avatar

Exclude Link Suggestions keeps media files and other clutter out of the block editor’s link suggestions, so when you add a link, you find the post you meant. Media is left out as soon as you activate it, and you can choose other post types and taxonomies to hide too.

Before you start

  • WordPress 5.0 or later
  • PHP 5.6 or later
  • The block editor

Install

  1. In your WordPress dashboard, go to Plugins → Add New Plugin.
  2. Click Upload Plugin.
  3. Choose the plugin zip file.
  4. Click Install Now.
  5. Click Activate.

That’s it. Media attachments are hidden from link suggestions right away.

How to use

  1. Go to Settings → Exclude Link Suggestions.
  2. Under Post Types, check each post type you want hidden.
  3. Under Taxonomies, check each taxonomy you want hidden (for example, tags).
  4. Click Save Changes.

Next time you add a link in the post editor or Site Editor and start typing, the checked types won’t show up in the suggestions.

Settings

  • Post Types: a checkbox for each public post type on your site, shown with its name and slug. Checked types are hidden from link suggestions. Default: only Media (attachment) is checked.
  • Taxonomies: a checkbox for each public taxonomy. Checked taxonomies are hidden from link suggestions. Default: none checked.

Only administrators (users who can manage options) can see this page.

Developer reference

Coming soon: the hooks, filters and functions you can use with this plugin from your theme or a code snippet.

FAQs

Do I have to set anything up?

No. Media is excluded by default. Visit the settings page only if you want to hide more.

I want media back in my link suggestions. How?

Go to Settings → Exclude Link Suggestions, uncheck Media and click Save Changes.

Can I still link to a media file?

Yes. Paste the file’s URL into the link field. The plugin only removes items from the search suggestions.

Does it change my Media Library or the front end of my site?

No. It only filters searches made from the post editor (post.php, post-new.php) and the Site Editor (site-editor.php). Nothing is deleted or hidden on your site.