Select2 for parent select field (when using Gutenberg)
-
I have an issue with choosing the parent page in pages.
The list has a couple of hundreds of pages and finding the right parent is difficult.I wanted to add the Select2 to the select field responsible for choosing a parent.
But the parent field in new WordPress version with Gutenberg isn’t loaded when the page is loaded. It is loaded when we click on Page Attributes dropdown. So this code does not work (it would work with classic editor):
$(document).ready(function(){
jQuery(‘.here-class-of-the-select-field’).select2();
});of course in my script, there is a correct class name of the select field.
And select2 is properly enqueued. But it doesn’t matter because the field isn’t loaded when the page is loaded.
The topic ‘Select2 for parent select field (when using Gutenberg)’ is closed to new replies.