WordPress Customizer add_control Dropdown of Pages with Multi Select?

Yes, this is possible, but you will have to really, really want it. It’s difficult, because WordPress does not natively support the multiple argument on select inputs in the customizer. You can see this in de the render_content function which outputs the html (just search the function for <select). And even if you would succeed to add the argument, the customizer wouldn’t know what to do with the selected items.

So, to get this done, you will have to extend the customizer. In terms of lines of code this is doable. WordPress itself contains multiple extensions to the customizer controls, for instance to add a color picker as an input type. Here’s roughly what to do:

  1. Create a new file WP_Customize_Control_Multiselect
  2. Check out the basic content in the color picker. You will need a line public $type="multiselect";, a simple constructor like the one in the color picker and a rendering function which you can adapt from the dropdown-pages part of WP_Customize_Control.
  3. Don’t forget to include the file in your functions.php and call the control with $wp_customize->add_control (new Customize_Control_Multiselect ...

tech