diff --git a/package-lock.json b/package-lock.json index de9be8e893e605..eb7426ed24ba6c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18929,6 +18929,7 @@ "@wordpress/data": "file:packages/data", "@wordpress/deprecated": "file:packages/deprecated", "@wordpress/element": "file:packages/element", + "@wordpress/hooks": "file:packages/hooks", "@wordpress/html-entities": "file:packages/html-entities", "@wordpress/i18n": "file:packages/i18n", "@wordpress/is-shallow-equal": "file:packages/is-shallow-equal", diff --git a/packages/core-data/package.json b/packages/core-data/package.json index 3f657d7c32cf87..0fa4adfe77976d 100644 --- a/packages/core-data/package.json +++ b/packages/core-data/package.json @@ -35,6 +35,7 @@ "@wordpress/data": "file:../data", "@wordpress/deprecated": "file:../deprecated", "@wordpress/element": "file:../element", + "@wordpress/hooks": "file:../hooks", "@wordpress/html-entities": "file:../html-entities", "@wordpress/i18n": "file:../i18n", "@wordpress/is-shallow-equal": "file:../is-shallow-equal", diff --git a/packages/core-data/src/fetch/__experimental-fetch-link-suggestions.js b/packages/core-data/src/fetch/__experimental-fetch-link-suggestions.js index add566050d4b31..aa892a8c4352b8 100644 --- a/packages/core-data/src/fetch/__experimental-fetch-link-suggestions.js +++ b/packages/core-data/src/fetch/__experimental-fetch-link-suggestions.js @@ -3,6 +3,7 @@ */ import apiFetch from '@wordpress/api-fetch'; import { addQueryArgs } from '@wordpress/url'; +import { applyFilters } from '@wordpress/hooks'; import { decodeEntities } from '@wordpress/html-entities'; import { __ } from '@wordpress/i18n'; @@ -154,7 +155,12 @@ const fetchLinkSuggestions = async ( } return Promise.all( queries ).then( ( results ) => { - return results + const filteredResults = applyFilters( + 'editor.fetchLink.suggestions', + results, + search + ); + return filteredResults .reduce( ( accumulator, current ) => accumulator.concat( current ), //flatten list []