I'm trying to edit the slug
field on the right panel of Gutenberg editor and edit its content based on a custom field.
I noticed that I can access the field by using this JavaScript to interact with the React Component:
wp.data.select('core/editor').getEditedPostSlug();
My question is: How can I edit this field in JavaScript?
There's no .setEditedPostSlug()
method for this and select the field in normal JS script is impossible because the field's ID is generated each time the panel is opened and if we close the panel, the field disappear from the DOM.