'', 'total' => '-1', ), $atts, 'wpaf_coupon' ); /** * Arguments to be used for a custom Query. * * @since 1.0 */ $wpaf_arg = array( 'p' => esc_attr( $wpaf_atts['id'] ), 'posts_per_page' => esc_attr( $wpaf_atts['total'] ), 'post_type' => 'wpaf_coupons', 'post_status' => 'publish', ); /** * New custom query to get post and post data * from the custom coupon post type. * * @since 1.0 */ $wpaf_coupon = new WP_Query( $wpaf_arg ); $output = ''; //Hide expired coupon feature $today = gmdate( 'd-m-Y' ); $hide_expired_coupon = get_option( 'wpaf_hide-expired-coupon' ); while ( $wpaf_coupon->have_posts() ) { $wpaf_coupon->the_post(); global $wpaf_coupon_id; $template = new WPAF_Template_Loader(); $wpaf_coupon_id = get_the_ID(); $expire_date = get_post_meta( $wpaf_coupon_id, 'coupon_details_expire-date', true ); $coupon_template = get_post_meta( $wpaf_coupon_id, 'coupon_details_coupon-template', true ); $coupon_type = get_post_meta( $wpaf_coupon_id, 'coupon_details_coupon-type', true ); if ( $coupon_type === 'Image' ) { ob_start(); $template->get_template_part( 'shortcode-image' ); $output = ob_get_clean(); if ( WPAF_Amp::wpaf_amp_is() ) { WPAF_Amp::instance()->setCss( 'shortcode_image' ); } wp_reset_postdata(); return $output; } // Hide expired coupon feature (default is Not to hide). if ( ! empty( $hide_expired_coupon ) || $hide_expired_coupon == "on" ) { $expire_date = get_post_meta( $wpaf_coupon_id, 'coupon_details_expire-date', true ); if ( ! empty( $expire_date ) ) { if ( (string) (int) $expire_date != $expire_date ) { $expire_date = strtotime( $expire_date ); } if ( $coupon_template !== 'Template Four' ) { if ( $expire_date < strtotime( $today ) ) { continue; } } else { $second_expire_date = get_post_meta( $wpaf_coupon_id, 'coupon_details_second-expire-date', true ); $third_expire_date = get_post_meta( $wpaf_coupon_id, 'coupon_details_third-expire-date', true ); if ( $expire_date < strtotime( $today ) && $second_expire_date < strtotime( $today ) && $third_expire_date < strtotime( $today ) ) { continue; } } } } if ( $coupon_template == 'Template One' ) { $argcss = 'shortcode_one'; ob_start(); $template->get_template_part( 'shortcode-one' ); $output = ob_get_clean(); } elseif ( $coupon_template == 'Template Two' ) { $argcss = 'shortcode_two'; ob_start(); $template->get_template_part( 'shortcode-two' ); $output = ob_get_clean(); } elseif ( $coupon_template == 'Template Three' ) { $argcss = 'shortcode_three'; ob_start(); $template->get_template_part( 'shortcode-three' ); $output = ob_get_clean(); } elseif ( $coupon_template == 'Template Four' ) { $argcss = 'shortcode_four'; ob_start(); $template->get_template_part( 'shortcode-four' ); $output = ob_get_clean(); } elseif ( $coupon_template == 'Template Five' ) { $argcss = 'shortcode_five'; ob_start(); $template->get_template_part( 'shortcode-five' ); $output = ob_get_clean(); } elseif ( $coupon_template == 'Template Six' ) { $argcss = 'shortcode_six'; ob_start(); $template->get_template_part( 'shortcode-six' ); $output = ob_get_clean(); } elseif ( $coupon_template == 'Template Seven' ) { $argcss = 'shortcode_seven'; ob_start(); $template->get_template_part( 'shortcode-seven' ); $output = ob_get_clean(); } elseif ( $coupon_template == 'Template Eight' ) { $argcss = 'shortcode_eight'; ob_start(); $template->get_template_part( 'shortcode-eight' ); $output = ob_get_clean(); } else { $argcss = 'shortcode_default'; ob_start(); $template->get_template_part( 'shortcode-default' ); $output = ob_get_clean(); } if ( WPAF_Amp::wpaf_amp_is() ) { WPAF_Amp::instance()->setCss( 'shortcode_common' ); WPAF_Amp::instance()->setCss( $argcss ); $user_stylesheets = WPAF_Assets::wpaf_stylesheets( true, $wpaf_coupon_id, $coupon_template ); WPAF_Amp::instance()->setCss( $user_stylesheets, false ); } } wp_reset_postdata(); return $output; } /** * Builds the only coupon code shortcode. * * @param $atts * * @return string * * @since 1.0 */ public static function wpaf_coupon_code( $atts ) { global $wpaf_code_atts; global $wpaf_coupon_code; /** * These are the shortcode attributes. * * @since 1.0 */ $wpaf_code_atts = shortcode_atts( array( 'id' => '', 'total' => '-1' ), $atts, 'wpaf_code' ); /** * Arguments to be used for a custom Query. * * @since 1.0 */ $wpaf_code_arg = array( 'p' => esc_attr( $wpaf_code_atts['id'] ), 'posts_per_page' => esc_attr( $wpaf_code_atts['total'] ), 'post_type' => 'wpaf_coupons', 'post_status' => 'publish', ); /** * New custom query to get post and post data * from the custom coupon post type. * * @since 1.0 */ $wpaf_coupon_code = new WP_Query( $wpaf_code_arg ); $template = new WPAF_Template_Loader(); ob_start(); $template->get_template_part( 'shortcode-code' ); // Return Variables $output = ob_get_clean(); if ( WPAF_Amp::wpaf_amp_is() ) { WPAF_Amp::instance()->setCss( 'shortcode_common' ); } wp_reset_postdata(); return $output; } /** * Shortcode for the coupon archive page. * * @param $atts * * @return string */ public static function wpaf_coupons_archive_func( $atts ) { $output = ""; $paged = 1; $wpaf_data_taxonomy = 'all'; $wpaf_data_search = ''; $a = shortcode_atts( array( 'count' => '9', 'temp' => '' ), $atts ); $archive_category_setting = get_option( 'wpaf_archive-munu-categories' ); if ( $archive_category_setting == 'vendor' ) { $terms = get_terms( array( 'taxonomy' => 'wpaf_coupon_vendor' ) ); $wpaf_coupon_taxonomy = WPAF_Plugin::VENDOR_TAXONOMY; $wpaf_term_field_name = 'wpaf_vendor'; } else { $terms = get_terms( array( 'taxonomy' => 'wpaf_coupon_category' ) ); $wpaf_coupon_taxonomy = WPAF_Plugin::CUSTOM_TAXONOMY; $wpaf_term_field_name = 'wpaf_category'; } // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Action discriminator only; nonce verified inside this branch via check_ajax_referer. if ( isset( $_POST['action'] ) && 'wpaf_coupons_category_action' === $_POST['action'] ) { if ( ! check_ajax_referer( 'wpaf-security-nonce', 'security' ) ) { wp_die(); } // Nonce verified above. Extract POST values, validate, then push the // validated values into WordPress query vars so the templates below can // read uniformly via get_query_var() without touching $_POST/$_GET. $posted_template = isset( $_POST['coupon_template'] ) ? sanitize_text_field( wp_unslash( $_POST['coupon_template'] ) ) : ''; if ( '' !== $posted_template ) { $a['temp'] = $posted_template; } $posted_count = isset( $_POST['coupon_items_count'] ) ? absint( wp_unslash( $_POST['coupon_items_count'] ) ) : 0; if ( $posted_count > 0 ) { $a['count'] = $posted_count; } $posted_paged = isset( $_POST['wpaf_page_num'] ) ? absint( wp_unslash( $_POST['wpaf_page_num'] ) ) : 0; if ( $posted_paged > 0 ) { $paged = $posted_paged; } $posted_term = isset( $_POST[ $wpaf_term_field_name ] ) ? sanitize_text_field( wp_unslash( $_POST[ $wpaf_term_field_name ] ) ) : ''; if ( '' !== $posted_term && get_term_by( 'slug', $posted_term, $wpaf_coupon_taxonomy ) ) { $wpaf_data_taxonomy = $posted_term; } $posted_search = isset( $_POST['search_text'] ) ? sanitize_text_field( wp_unslash( $_POST['search_text'] ) ) : ''; if ( '' !== $posted_search ) { if ( $posted_search === trim( $posted_search ) ) { $wpaf_data_search = $posted_search; } else { $output = '
' . esc_html__( 'Sorry, no coupons/deals found.', 'affcoupon' ) . '
'; wp_send_json( $output ); } } // Make the validated values available to downstream templates uniformly. set_query_var( 'wpaf_page_num', $paged ); set_query_var( $wpaf_term_field_name, $wpaf_data_taxonomy ); set_query_var( 'wpaf_search', $wpaf_data_search ); } else { wp_enqueue_script( 'wpaf-main-js' ); // Read pagination + taxonomy filter from registered query vars (populated // from URL query string by WP). These are read-only public params (like // WP's own pagination links) so they do not require a nonce. $page_from_url = absint( get_query_var( 'wpaf_page_num' ) ); if ( $page_from_url > 0 ) { $paged = $page_from_url; } $term_from_url = sanitize_text_field( get_query_var( $wpaf_term_field_name ) ); if ( '' !== $term_from_url && get_term_by( 'slug', $term_from_url, $wpaf_coupon_taxonomy ) ) { $wpaf_data_taxonomy = $term_from_url; } } if ( $wpaf_data_taxonomy != 'all' && $wpaf_data_taxonomy != '' && empty( $wpaf_data_search ) ) { $args = array( 'post_type' => 'wpaf_coupons', 'order' => 'DESC', 'posts_per_page' => $a['count'], // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query -- Required to filter coupons by taxonomy in shortcode output. 'tax_query' => array( array( 'taxonomy' => $wpaf_coupon_taxonomy, 'field' => 'slug', 'terms' => $wpaf_data_taxonomy, ), ), 'paged' => $paged ); } elseif ( ! empty( $wpaf_data_search ) ) { $args = array( 'post_type' => 'wpaf_coupons', 'order' => 'DESC', 'posts_per_page' => $a['count'], 'paged' => $paged, 's' => $wpaf_data_search, ); } else { $args = array( 'post_type' => 'wpaf_coupons', 'order' => 'DESC', 'posts_per_page' => $a['count'], 'paged' => $paged, ); } if ( empty( $a['temp'] ) ) { // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query -- Required to exclude image-type coupons from default shortcode listing. $args['meta_query'] = array( array( 'key' => 'coupon_details_coupon-type', 'value' => 'Image', 'compare' => '!=' ) ); } // exclude expired coupons if hide expired coupon setting is enabled. $expired_coupons = array(); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) { $today = gmdate( 'd-m-Y' ); $hide_expired_coupon = get_option( 'wpaf_hide-expired-coupon' ); while ( $the_query->have_posts() ) { $the_query->the_post(); global $wpaf_coupon_id; $wpaf_coupon_id = get_the_ID(); $expire_date = get_post_meta( $wpaf_coupon_id, 'coupon_details_expire-date', true ); $current_coupon_template = get_post_meta( $wpaf_coupon_id, 'coupon_details_coupon-template', true ); $coupon_type = get_post_meta( $wpaf_coupon_id, 'coupon_details_coupon-type', true ); if ( ! empty( $hide_expired_coupon ) || $hide_expired_coupon == "on" ) { $expire_date = get_post_meta( $wpaf_coupon_id, 'coupon_details_expire-date', true ); if ( ! empty( $expire_date ) ) { if ( (string) (int) $expire_date != $expire_date ) { $expire_date = strtotime( $expire_date ); } if ( $current_coupon_template !== 'Template Four' ) { if ( $expire_date < strtotime( $today ) ) { array_push( $expired_coupons, $wpaf_coupon_id ); continue; } } else { $second_expire_date = get_post_meta( $wpaf_coupon_id, 'coupon_details_second-expire-date', true ); $third_expire_date = get_post_meta( $wpaf_coupon_id, 'coupon_details_third-expire-date', true ); if ( $expire_date < strtotime( $today ) && $second_expire_date < strtotime( $today ) && $third_expire_date < strtotime( $today ) ) { array_push( $expired_coupons, $wpaf_coupon_id ); continue; } } } } } wp_reset_postdata(); } if ( count( $expired_coupons ) > 0 ) { // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in -- Required to exclude expired coupons when 'hide expired' option is enabled. $args['post__not_in'] = $expired_coupons; } $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) : /** * $wpaf_parent -> print the header and footer of the parent element * $wpaf_max_num_page -> used in pagination * $coupon_template -> the name of template * $num_posts -> number of posts * $wpaf_current_url -> return the Url of the current post */ global $wpaf_parent, $wpaf_max_num_page, $wpaf_current_url; $num_posts = $the_query->post_count; $i = 1; $wpaf_max_num_page = $the_query->max_num_pages; $wpaf_current_url = get_permalink(); // template system. $temp = $a['temp']; $argcss = array(); if ( $temp == '' ) { // vertical style. $argcss = 'archive_not_temp'; $coupon_template = 'shortcode-archive'; } else { switch ( $temp ) { case 'one': $argcss = 'archive_one'; $coupon_template = 'shortcode-archive-one'; break; case 'two': $argcss = 'archive_two'; $coupon_template = 'shortcode-archive-two'; break; case 'three': $argcss = 'archive_three'; $coupon_template = 'shortcode-archive-three'; break; case 'seven': $argcss = 'archive_seven'; $coupon_template = 'shortcode-archive-seven'; break; case 'eight': $argcss = 'archive_eight'; $coupon_template = 'shortcode-archive-eight'; break; default : $argcss = 'archive_default'; $coupon_template = 'shortcode-archive-default'; break; } } if ( WPAF_Amp::wpaf_amp_is() ) { WPAF_Amp::instance()->setCss( 'archive_common' ); WPAF_Amp::instance()->setCss( 'shortcode_common' ); if ( $argcss == 'archive_default' ) { WPAF_Amp::instance()->setCss( 'shortcode_five' ); WPAF_Amp::instance()->setCss( 'shortcode_six' ); WPAF_Amp::instance()->setCss( 'shortcode_default' ); } else { WPAF_Amp::instance()->setCss( $argcss ); } $user_stylesheets = WPAF_Assets::wpaf_stylesheets( true ); WPAF_Amp::instance()->setCss( $user_stylesheets, false ); } if ( ! WPAF_Amp::wpaf_amp_is() && ( ! isset( $_POST['action'] ) || $_POST['action'] != 'wpaf_coupons_category_action' ) ) { global $post; $wpaf_data_coupon_page_url = get_page_link( $post->ID ); $wpaf_coupon_taxonomy_attr = in_array( $wpaf_coupon_taxonomy, array( WPAF_Plugin::CUSTOM_TAXONOMY, WPAF_Plugin::VENDOR_TAXONOMY ), true ) ? $wpaf_coupon_taxonomy : WPAF_Plugin::CUSTOM_TAXONOMY; $output = ''; } // the loop. while ( $the_query->have_posts() ) : $the_query->the_post(); global $wpaf_coupon_id; $wpaf_coupon_id = get_the_ID(); $wpaf_parent = ""; // check to print header or footer. if ( $i == 1 && $num_posts !== 1 ) { $wpaf_parent = 'header'; } elseif ( $num_posts == 1 ) { // means there's only one coupon // So, it should print the header and footer in this time $wpaf_parent = 'headerANDfooter'; } elseif ( $i == $num_posts ) { $wpaf_parent = 'footer'; } $template = new WPAF_Template_Loader(); ob_start(); $template->get_template_part( $coupon_template ); $output .= ob_get_clean(); $i ++; endwhile; // end of the loop. wp_reset_postdata(); else : $output .= '' . esc_html__( 'Sorry, no coupons/deals found.', 'affcoupon' ) . '
'; endif; // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Action discriminator only; nonce verified inside this branch via check_ajax_referer. if ( isset( $_POST['action'] ) && $_POST['action'] == 'wpaf_coupons_category_action' ) { wp_send_json( $output ); } return $output; } /** * Coupon loop shortcode to specific posts or posts from a category. * * @param $atts * * @return string */ public static function wpaf_coupons_loop_func( $atts ) { $output = ""; $paged = 1; $a = shortcode_atts( array( 'count' => 9, 'id' => '', 'cat' => '', 'vend' => '', 'temp' => '' ), $atts ); // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Action discriminator only; nonce verified inside this branch via check_ajax_referer. if ( isset( $_POST['action'] ) && 'wpaf_coupons_cat_vend_action' === $_POST['action'] ) { if ( ! check_ajax_referer( 'wpaf-security-nonce', 'security' ) ) { wp_die(); } // Nonce verified above. Extract POST values, validate, then push the // validated values into WordPress query vars so the templates below can // read uniformly via get_query_var() without touching $_POST/$_GET. $posted_template = isset( $_POST['coupon_template'] ) ? sanitize_text_field( wp_unslash( $_POST['coupon_template'] ) ) : ''; if ( '' !== $posted_template ) { $a['temp'] = $posted_template; } $posted_count = isset( $_POST['coupon_items_count'] ) ? absint( wp_unslash( $_POST['coupon_items_count'] ) ) : 0; if ( $posted_count > 0 ) { $a['count'] = $posted_count; } $posted_paged = isset( $_POST['wpaf_page_num'] ) ? absint( wp_unslash( $_POST['wpaf_page_num'] ) ) : 0; if ( $posted_paged > 0 ) { $paged = $posted_paged; } $posted_cat = isset( $_POST['wpaf_data_category_coupons'] ) ? sanitize_text_field( wp_unslash( $_POST['wpaf_data_category_coupons'] ) ) : ''; if ( '' !== $posted_cat ) { $a['cat'] = $posted_cat; } $posted_vend = isset( $_POST['wpaf_data_vendor_coupons'] ) ? sanitize_text_field( wp_unslash( $_POST['wpaf_data_vendor_coupons'] ) ) : ''; if ( '' !== $posted_vend ) { $a['vend'] = $posted_vend; } $posted_ven_cat_id = isset( $_POST['wpaf_data_ven_cat_id'] ) ? sanitize_text_field( wp_unslash( $_POST['wpaf_data_ven_cat_id'] ) ) : ''; if ( '' !== $posted_ven_cat_id ) { $a['id'] = $posted_ven_cat_id; } // Make the validated page number available to downstream templates // (hide-coupon* templates) uniformly via get_query_var(). set_query_var( 'wpaf_page_num', $paged ); } else { wp_enqueue_script( 'wpaf-main-js' ); // Read pagination from the registered query var (populated by WP from // the URL query string). Read-only public param, no nonce required. $page_from_url = absint( get_query_var( 'wpaf_page_num' ) ); if ( $page_from_url > 0 ) { $paged = $page_from_url; } } if ( $a['temp'] == '' ) { // vertical style $argcss = 'archive_not_temp'; $coupon_template = 'shortcode-category'; } else { switch ( $a['temp'] ) { case 'one': $argcss = 'archive_one'; $coupon_template = 'shortcode-category-one'; break; case 'two': $argcss = 'archive_two'; $coupon_template = 'shortcode-category-two'; break; case 'three': $argcss = 'archive_three'; $coupon_template = 'shortcode-category-three'; break; case 'seven': $argcss = 'archive_seven'; $coupon_template = 'shortcode-category-seven'; break; case 'eight': $argcss = 'archive_eight'; $coupon_template = 'shortcode-category-eight'; break; default : $argcss = 'archive_default'; $coupon_template = 'shortcode-category-default'; break; } } if ( WPAF_Amp::wpaf_amp_is() ) { WPAF_Amp::instance()->setCss( 'archive_common' ); WPAF_Amp::instance()->setCss( 'shortcode_common' ); if ( $argcss == 'archive_default' ) { WPAF_Amp::instance()->setCss( 'shortcode_five' ); WPAF_Amp::instance()->setCss( 'shortcode_six' ); WPAF_Amp::instance()->setCss( 'shortcode_default' ); } else { WPAF_Amp::instance()->setCss( $argcss ); } $user_stylesheets = WPAF_Assets::wpaf_stylesheets( true ); WPAF_Amp::instance()->setCss( $user_stylesheets, false ); } if ( ! WPAF_Amp::wpaf_amp_is() && ( ! isset( $_POST['action'] ) || $_POST['action'] != 'wpaf_coupons_cat_vend_action' ) ) { global $post; $wpaf_data_coupon_page_url = get_page_link( $post->ID ); $output = ''; } if ( $a['cat'] || $a['vend'] ) { $args = array( 'post_type' => 'wpaf_coupons', 'order' => 'DESC', 'posts_per_page' => $a['count'], // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query -- Required to filter coupons by taxonomy in shortcode output. 'tax_query' => array( array( 'taxonomy' => ( $a['cat'] ) ? 'wpaf_coupon_category' : 'wpaf_coupon_vendor', 'field' => 'term_id', 'terms' => ( $a['cat'] ) ? $a['cat'] : $a['vend'], ), ), 'paged' => $paged ); } else { if ( $a['id'] ) { $posts_in = array_map( 'intval', explode( ',', $a['id'] ) ); $args = array( 'post_type' => 'wpaf_coupons', 'post_status' => 'publish', 'post__in' => $posts_in ); } else { $args = array( 'post_type' => 'wpaf_coupons', 'order' => 'DESC', 'posts_per_page' => $a['count'], 'paged' => $paged, ); } } if ( empty( $a['temp'] ) ) { // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query -- Required to exclude image-type coupons from default shortcode listing. $args['meta_query'] = array( array( 'key' => 'coupon_details_coupon-type', 'value' => 'Image', 'compare' => '!=' ) ); } // Filter expired coupons before rendering so wrapper/header/footer markup stays balanced. $expired_coupons = array(); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) { $today = gmdate( 'd-m-Y' ); $hide_expired_coupon = get_option( 'wpaf_hide-expired-coupon' ); while ( $the_query->have_posts() ) { $the_query->the_post(); $wpaf_coupon_id = get_the_ID(); if ( ! empty( $hide_expired_coupon ) || $hide_expired_coupon == "on" ) { $expire_date = get_post_meta( $wpaf_coupon_id, 'coupon_details_expire-date', true ); if ( ! empty( $expire_date ) ) { if ( (string) (int) $expire_date != $expire_date ) { $expire_date = strtotime( $expire_date ); } if ( $expire_date < strtotime( $today ) ) { $expired_coupons[] = $wpaf_coupon_id; } } } } wp_reset_postdata(); } if ( count( $expired_coupons ) > 0 ) { // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in -- Required to exclude expired coupons when 'hide expired' option is enabled. $args['post__not_in'] = $expired_coupons; } $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) : /** * $wpaf_parent -> print the header and footer of the parent element * $wpaf_max_num_page -> used in pagination * $coupon_template -> the name of template * $num_posts -> number of posts */ global $wpaf_parent, $wpaf_max_num_page; $wpaf_max_num_page = $the_query->max_num_pages; $num_posts = $the_query->post_count; $i = 1; while ( $the_query->have_posts() ) : $the_query->the_post(); global $wpaf_coupon_id; $wpaf_parent = ""; // check to print header or footer. if ( $i == 1 && $num_posts !== 1 ) { $wpaf_parent = 'header'; } elseif ( $num_posts == 1 ) { $wpaf_parent = 'headerANDfooter'; } elseif ( $i == $num_posts ) { $wpaf_parent = 'footer'; } $template = new WPAF_Template_Loader(); $wpaf_coupon_id = get_the_ID(); ob_start(); $template->get_template_part( $coupon_template ); $output .= ob_get_clean(); $i ++; endwhile; // end of the loop wp_reset_postdata(); else : $output .= '' . esc_html__( 'Sorry, no coupons/deals found.', 'affcoupon' ) . '
'; endif; // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Action discriminator only; nonce verified inside this branch via check_ajax_referer. if ( isset( $_POST['action'] ) && $_POST['action'] == 'wpaf_coupons_cat_vend_action' ) { wp_send_json( $output ); } return $output; } }