Badgeos_Helpers::select_ranks_from_types_func()
Return all the specific fields of a form ID provided in ajax call
Source
File: src/integrations/badgeos/helpers/badgeos-helpers.php
public function select_ranks_from_types_func() { // Nonce and post object validation. Automator()->utilities->ajax_auth_check( $_POST ); $fields = array(); if ( isset( $_POST['value'] ) && ! empty( $_POST['value'] ) ) { $args = [ 'post_type' => sanitize_text_field( $_POST['value'] ), 'posts_per_page' => 999, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'publish', ]; $options = Automator()->helpers->recipe->options->wp_query( $args, false, esc_attr__( 'Any awards', 'uncanny-automator' ) ); foreach ( $options as $award_id => $award_name ) { $fields[] = [ 'value' => $award_id, 'text' => $award_name, ]; } } echo wp_json_encode( $fields ); die(); }
Expand full source code Collapse full source code View on Github