jQuery(function ($) {
$(document).ready(function () {
$('[data-cpt-type="parent"]').change(function () {
const child = $('[data-cpt-type="child"]');
const parent_id = $(this).find(':selected').data('id');
const parent_cpt = $(this).data('cpt');
const brand_id = $(this).data('brand-id');
const child_cpt = child.data('cpt');
if (!parent_id) {
return;
}
$.get(
dropdownSettings.ajaxurl,
{ action: 'load_dynamic_options', parent_id, parent_cpt, child_cpt, brand_id },
function (res) {
child.find('option').not(':first').remove();
res.posts.forEach(function (item) {
child.append(
$('