$form['id'], 'post_title' => $form['name'], ); } // Return our results wp_send_json_success( $results ); die; } } add_action( 'wp_ajax_gamipress_get_posts', 'gamipress_kadence_blocks_ajax_get_posts', 5 ); /** * Get all forms * * @since 1.0.0 * * @return string|null */ function gamipress_kadence_blocks_get_forms( ) { global $wpdb; $all_forms = array(); $forms = $wpdb->get_results( "select id,post_title,post_content from {$wpdb->posts} where post_content like '%', $temp, 2); $content[] = json_decode($temp1[0]); } } if (is_array($content)) { foreach ($content as $form) { $parent_id = $form->postID; $unique_id = $form->uniqueID; $all_forms[] = array( 'id' => $unique_id, 'name' => $form_title . '_' . $unique_id, ); } } } return $all_forms; } /** * Get the form title * * @since 1.0.0 * * @param int $form_id * * @return string|null */ function gamipress_kadence_blocks_get_form_title( $form_id ) { // Empty title if no ID provided if( empty( $form_id ) ) { return ''; } $complete_form_id = explode( '_', $form_id ); $post_title = get_the_title( $complete_form_id[0] ); return $post_title . '_' . $form_id; }