Ajax Select

It allows select data like posts and pages from ajax retrieved data list.

Name Type Default Description
type string ‘ajax-select’ Value identifies the field types.
id string Identifies unique ID for the field. It must be different from other existing field IDs.
title string Displays the field label.
desc string Describe the field option in details, appears underneath the field control.
required array Acts like boolean operator and provides the parent, comparison operation, and value which decides the field visibility.
value string Display default string in the text input.
placeholder string Default message to display when no input is inserted.
hooks array Display ajax retrieved data
multiple boolean false allows to select multiple value from select options


    'id'    => 'ajaxselect',
    'title' => esc_html__( 'Label', 'ultimate-page-builder' ),
    'desc'  => wp_kses_post( __( 'Description', 'ultimate-page-builder' )),
    'type'  => 'ajax-select',
    // 'multiple'=>true,
    'value' => '',
        'search'=>'search_hook', // wp_ajax__search_hook
        'load'=>'load_hook'      // wp_ajax__load_hook

        'type'  => 'GET', // POST

NOTE: If you have multiple select option then your default value should be array otherwise it can be string.


  • multiple - Support multiple select option. Default false


Here Hooks has used to fetch data like posts and pages through Ajax call. It's an associative array which have search and load key. search key is for searching data and load to populate selected data.

  • search - If no search hook it provided default ajax hook will be: _upb_element_[tag]_[id]_search.

  • load - If no load hook it provided default ajax hook will be: _upb_element_[tag]_[id]_load.


  • You want to use Posts. You can use: _upb_search_posts value as search hook key and _upb_load_post value for load hook key.

  • You want to use Pages. You can use: _upb_search_pages value as search hook key and _upb_load_pages value for load hook key.

  • settings - you can set select2 settings from this key.

    • allowClear - Show × cross button to clear field. Default is true. But false on multiple
  • ajaxOptions - you can change ajax data sending method and enable or disable ajax data caching.

    • type - Sending type. Default method type is GET.
    • cache - Data caching. Default is true.

results matching ""

    No results matching ""