| 1 |
import { addFilter } from "@wordpress/hooks"; |
| 2 |
import apiFetch from "@wordpress/api-fetch"; |
| 3 |
import { withSuggestTerms } from "./SuggestTerms"; |
| 4 |
|
| 5 |
const config = window.betterdocsDocsAI || {}; |
| 6 |
|
| 7 |
// Authenticate REST calls (the endpoint uses the standard wp_rest nonce). |
| 8 |
if ( config.nonce ) { |
| 9 |
apiFetch.use( apiFetch.createNonceMiddleware( config.nonce ) ); |
| 10 |
} |
| 11 |
|
| 12 |
// Inject "Suggest Categories / Tags" into the native taxonomy panels. |
| 13 |
addFilter( |
| 14 |
"editor.PostTaxonomyType", |
| 15 |
"betterdocs/docs-ai-suggest-terms", |
| 16 |
withSuggestTerms |
| 17 |
); |
| 18 |
|