query['ar_woo_cat'])) return $template; if ($wp_query->query['ar_woo_cat'] == 'catList') { $Domain_name = $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI']; $fetch_url = strtok($Domain_name, '?'); $match_parse = rtrim($fetch_url, '/'); $nonce = decryptIt($_REQUEST['nonce']); if ((isset($nonce) != '') && $nonce != $match_parse) { echo "Not secure Connection"; exit; } $args = array('post_type' => 'product', 'posts_per_page' => -1, "orderby" => 'title', 'meta_key' => 'ar_woo_product_Detail'); $loop = new WP_Query($args); $all_categories = array(); $count = $loop->post_count; $term_id = array(); if ($count > 0) { while ($loop->have_posts()) : $loop->the_post(); global $product; $get_model_check = get_post_meta($product->post->ID, 'ar_woo_product_Detail', true); // Get Models Detail if (!empty($get_model_check)) { $category = get_the_terms($product->post->ID, 'product_cat'); if (!empty($category)) foreach ($category as $key => $data) { $get_categoty = $category[$key]; // Get Ptoduct Category if (!in_array($get_categoty->term_id, $term_id)) { $term_id[] = $get_categoty->term_id; $get_categoty->name = html_entity_decode($get_categoty->name); $all_categories[] = $get_categoty; } } } endwhile; if (sizeof($all_categories) > 0) { $categories = array("status" => 200, 'msg' => "Sucessfully Category Found", "category" => $all_categories); } else { $categories = array("status" => 400, 'msg' => "No Category Avilabel", "category" => ''); } $all_categories = $categories; //$all_categories = array("status"=>200,'msg'=>"Sucessfully Category Found","category"=>$all_categories); } else { $all_categories = array("status" => 400, 'msg' => "No Category Avilabel", "category" => ''); } echo json_encode($all_categories); wp_reset_query(); exit; } return $template; }