1

In WordPress's PHP library there is a function sanitize_key used to generate database keys and HTML IDs. I'd like to generate a slug from a title that can be used as an HTML ID, from within a Gutenberg block. Is there an equivalent (or close to equivalent) function in the Gutenberg library, or must I make my own?

  • The function cleanForSlug in Gutenberg's url.js seems to do the job. However I'm not sure if this is available to import into a Gutenberg block. – Sean Mar 19 at 22:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.