Published : June 29, 2026

CVE-2026-57687: Custom Field Template <= 2.7.8 Authenticated (Contributor+) SQL Injection PoC, Patch Analysis & Rule

Severity Medium (CVSS 6.5)
CWE 89
Vulnerable Version 2.7.8
Patched Version 2.8
Disclosed June 28, 2026

Analysis Overview

Atomic Edge analysis of CVE-2026-57687:

This vulnerability is an authenticated SQL Injection in the Custom Field Template WordPress plugin (versions prepare() with placeholders instead of directly concatenating user input. Before the patch, the input was concatenated directly into the query string. After the patch, the input is passed as a parameter to prepare(), which automatically escapes the value and prevents SQL injection. This is a proper fix because WordPress’s $wpdb->prepare() uses sprintf with %s placeholders that enforce proper quoting and escaping.

The impact is significant. An authenticated attacker (contributor or higher) can extract sensitive data from the entire WordPress database. This includes user credentials (hashed passwords), email addresses, session tokens, and any other custom data stored in the database. The CVSS score of 6.5 reflects the serious confidentiality impact combined with the relatively low authentication requirement. Given that many WordPress sites have multiple contributors, the risk of exploitation is moderate to high.

Differential between vulnerable and patched code

Below is a differential between the unpatched vulnerable code and the patched update, for reference.

Code Diff
--- a/custom-field-template/custom-field-template.php
+++ b/custom-field-template/custom-field-template.php
@@ -1,4686 +1,4750 @@
-<?php
-/*
-Plugin Name: Custom Field Template
-Plugin URI: https://www.wpcft.com/
-Description: This plugin adds the default custom fields on the Write Post/Page.
-Author: Hiroaki Miyashita
-Author URI: https://wpgogo.com/
-Version: 2.7.8
-Text Domain: custom-field-template
-Domain Path: /
-*/
-
-/*
-This program is based on the rc:custom_field_gui plugin written by Joshua Sigar.
-I appreciate your efforts, Joshua.
-*/
-
-/*  Copyright 2008 - 2026 Hiroaki Miyashita
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-class custom_field_template {
-	var $is_excerpt, $format_post_id;
-	private $replace_val;
-
-	function __construct() {
-		register_activation_hook( __FILE__, array(&$this, 'custom_field_template_register_activation_hook') );
-		add_action( 'plugins_loaded', array(&$this, 'custom_field_template_plugins_loaded') );
-		add_action( 'init', array(&$this, 'custom_field_template_init'), 100 );
-		add_action( 'admin_init', array(&$this, 'custom_field_template_admin_init') );
-		add_action( 'admin_menu', array(&$this, 'custom_field_template_admin_menu') );
-		add_action( 'admin_print_scripts', array(&$this, 'custom_field_template_admin_scripts') );
-		add_action( 'admin_head', array(&$this, 'custom_field_template_admin_head'), 100 );
-		add_action( 'admin_notices', array( &$this, 'custom_field_template_admin_notices' ) );
-		add_action( 'wp_ajax_dismiss_admin_notices', array(&$this, 'custom_field_template_dismiss_admin_notices') );
-		add_action( 'add_meta_boxes', array(&$this, 'custom_field_template_add_meta_boxes') );
-		add_action( 'edit_form_advanced', array(&$this, 'custom_field_template_edit_form_advanced') );
-		add_action( 'edit_page_form', array(&$this, 'custom_field_template_edit_form_advanced') );
-		add_action( 'block_editor_meta_box_hidden_fields', array( &$this, 'custom_field_template_edit_form_advanced' ) );
-
-		//add_action( 'edit_post', array(&$this, 'edit_meta_value'), 100 );
-		add_action( 'save_post', array(&$this, 'edit_meta_value'), 100, 2 );
-		//add_action( 'publish_post', array(&$this, 'edit_meta_value'), 100 );
-
-		add_action( 'delete_post', array(&$this, 'custom_field_template_delete_post'), 100 );
-
-		add_filter( 'media_send_to_editor', array(&$this, 'media_send_to_custom_field'), 15 );
-		add_filter( 'plugin_action_links', array(&$this, 'wpaq_filter_plugin_actions'), 100, 2 );
-
-		add_filter( 'get_the_excerpt', array(&$this, 'custom_field_template_get_the_excerpt'), 1 );
-		add_filter( 'the_content', array(&$this, 'custom_field_template_the_content') );
-		add_filter( 'the_content_rss', array(&$this, 'custom_field_template_the_content') );
-
-		add_filter( 'attachment_fields_to_edit', array(&$this, 'custom_field_template_attachment_fields_to_edit'), 10, 2 );
-		add_filter( '_wp_post_revision_fields', array(&$this, 'custom_field_template_wp_post_revision_fields'), 1 );
-		add_filter( 'edit_form_after_title', array(&$this, 'custom_field_template_edit_form_after_title') );
-
-		if ( isset($_REQUEST['cftsearch_submit']) ) :
-			add_action( 'post_limits', array(&$this, 'custom_field_template_post_limits'), 100);
-			add_filter( 'posts_join', array(&$this, 'custom_field_template_posts_join'), 100 );
-			add_filter( 'posts_where', array(&$this, 'custom_field_template_posts_where'), 100 );
-			add_filter( 'posts_orderby',  array(&$this, 'custom_field_template_posts_orderby'), 100 );
-		endif;
-
-		if ( function_exists('add_shortcode') ) :
-			add_shortcode( 'cft', array(&$this, 'output_custom_field_values') );
-			add_shortcode( 'cftsearch', array(&$this, 'search_custom_field_values') );
-		endif;
-
-		add_filter( 'get_post_metadata', array(&$this, 'get_preview_postmeta'), 10, 4 );
-		add_filter( 'wp_list_table_class_name', array(&$this, 'custom_field_template_wp_list_table_class_name'), 10, 2 );
-		add_action( 'custom_field_template_premium_code_update', array(&$this, 'custom_field_template_premium_code_update') );
-	}
-
-	function custom_field_template_register_activation_hook() {
-		delete_option( 'cft_admin_notices' );
-	}
-
-	function custom_field_template_plugins_loaded() {
-		load_plugin_textdomain('custom-field-template', false, plugin_basename( dirname( __FILE__ ) ) );
-	}
-
-	function custom_field_template_init() {
-		global $wp_version;
-		$options = $this->get_custom_field_template_data();
-
-		if ( is_user_logged_in() && current_user_can('edit_posts') && isset($_REQUEST['post']) && isset($_REQUEST['page']) && $_REQUEST['page'] == 'custom-field-template/custom-field-template.php' && $_REQUEST['cft_mode'] == 'selectbox' ) {
-			echo $this->custom_field_template_selectbox();
-			exit();
-		}
-
-		if ( is_user_logged_in() && isset($_REQUEST['post']) && isset($_REQUEST['page']) && $_REQUEST['page'] == 'custom-field-template/custom-field-template.php' && $_REQUEST['cft_mode'] == 'ajaxsave' ) {
-			if ( $_REQUEST['post'] > 0 && current_user_can( 'edit_post', $_REQUEST['post'] ) )
-				$this->edit_meta_value( $_REQUEST['post'], '' );
-			exit();
-		}
-
-		if ( is_user_logged_in() && current_user_can('edit_posts') && isset($_REQUEST['page']) && $_REQUEST['page'] == 'custom-field-template/custom-field-template.php' && $_REQUEST['cft_mode'] == 'ajaxload') {
-			if ( isset($_REQUEST['post']) && ! current_user_can( 'edit_post', $_REQUEST['post'] ) ) {
-				exit();
-			}
-			if ( isset($_REQUEST['id']) ) :
-				$id = $_REQUEST['id'];
-			elseif ( isset($options['posts'][$_REQUEST['post']]) ) :
-				$id = $options['posts'][$_REQUEST['post']];
-			else :
-				$filtered_cfts = $this->custom_field_template_filter();
-				if ( count($filtered_cfts)>0 ) :
-					$id = $filtered_cfts[0]['id'];
-				else :
-					$id = 0;
-				endif;
-			endif;
-			list($body, $init_id) = $this->load_custom_field( $id );
-			echo $body;
-			exit();
-		}
-
-		if( strstr($_SERVER['REQUEST_URI'], 'wp-admin/plugins.php') && ((isset($_GET['activate']) && $_GET['activate'] == 'true') || (isset($_GET['activate-multi']) && $_GET['activate-multi'] == 'true') ) ) {
-			$options = $this->get_custom_field_template_data();
-			if( !$options ) {
-				$this->install_custom_field_template_data();
-				$this->install_custom_field_template_css();
-			}
-		}
-
-		if ( function_exists('current_user_can') && current_user_can('edit_plugins') ) :
-			if ( isset($_POST['custom_field_template_export_options_submit']) ) :
-				$filename = "cft".date('Ymd');
-				header("Accept-Ranges: none");
-				header("Content-Disposition: attachment; filename=$filename");
-				header('Content-Type: application/octet-stream');
-				echo maybe_serialize($options);
-				exit();
-			endif;
-		endif;
-
-		if ( !empty($options['custom_field_template_widget_shortcode']) )
-			add_filter('widget_text', 'do_shortcode');
-
-		if ( substr($wp_version, 0, 3) >= '2.7' ) {
-			if ( empty($options['custom_field_template_disable_custom_field_column']) ) :
-				add_action( 'manage_posts_custom_column', array(&$this, 'add_manage_posts_custom_column'), 10, 2 );
-				add_filter( 'manage_posts_columns', array(&$this, 'add_manage_posts_columns') );
-				add_action( 'manage_pages_custom_column', array(&$this, 'add_manage_posts_custom_column'), 10, 2 );
-				add_filter( 'manage_pages_columns', array(&$this, 'add_manage_pages_columns') );
-			endif;
-			if ( empty($options['custom_field_template_disable_quick_edit']) )
-				add_action( 'quick_edit_custom_box', array(&$this, 'add_quick_edit_custom_box'), 10, 2 );
-		}
-
-		if ( substr($wp_version, 0, 3) < '2.5' ) {
-			add_action( 'simple_edit_form', array(&$this, 'insert_custom_field'), 1 );
-			add_action( 'edit_form_advanced', array(&$this, 'insert_custom_field'), 1 );
-			add_action( 'edit_page_form', array(&$this, 'insert_custom_field'), 1 );
-		}
-
-		if( strstr($_SERVER['REQUEST_URI'], 'wp-admin/post-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/post.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/page-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/page.php') ) :
-			add_action('admin_head', array(&$this, 'custom_field_template_admin_head_buffer') );
-			add_action('admin_footer', array(&$this, 'custom_field_template_admin_footer_buffer') );
-		endif;
-	}
-
-	function custom_field_template_admin_init() {
-		add_thickbox();
-
-		if ( ! wp_next_scheduled( 'custom_field_template_premium_code_update' ) ) :
-			wp_schedule_event( time(), 'daily', 'custom_field_template_premium_code_update' );
-		endif;
-	}
-
-	function custom_field_template_premium_code_update() {
-		$options = $this->get_custom_field_template_data();
-		$authentication_key = $options['custom_field_template_premium_code'];
-
-		if ( ! empty( $authentication_key ) ) :
-			$check_value = $this->custom_field_template_check_authentication_key( $authentication_key );
-			if ( $check_value == false ) :
-				$options['custom_field_template_premium_code'] = '';
-				update_option( 'custom_field_template_data', $options );
-			endif;
-		endif;
-	}
-
-	function custom_field_template_add_meta_boxes() {
-		$options = $this->get_custom_field_template_data();
-
-		if ( function_exists('remove_meta_box') && !empty($options['custom_field_template_disable_default_custom_fields']) ) :
-			remove_meta_box('postcustom', 'post', 'normal');
-			remove_meta_box('postcustom', 'page', 'normal');
-			remove_meta_box('pagecustomdiv', 'page', 'normal');
-		endif;
-
-		if ( !empty($options['custom_field_template_deploy_box']) ) :
-			if ( !empty($options['custom_fields']) ) :
-				$i = 0;
-				foreach ( $options['custom_fields'] as $key => $val ) :
-					if ( empty($options['custom_field_template_replace_the_title']) ) $title = __('Custom Field Template', 'custom-field-template');
-					else $title = $options['custom_fields'][$key]['title'];
-					if ( empty($options['custom_fields'][$key]['custom_post_type']) ) :
-						if ( empty($options['custom_fields'][$key]['post_type']) ) :
-							add_meta_box('cftdiv'.$i, $title, array(&$this, 'insert_custom_field'), 'post', 'normal', 'core', array('cft_id' => $key));
-							add_meta_box('cftdiv'.$i, $title, array(&$this, 'insert_custom_field'), 'page', 'normal', 'core', array('cft_id' => $key));
-						elseif ( $options['custom_fields'][$key]['post_type']=='post' ) :
-							add_meta_box('cftdiv'.$i, $title, array(&$this, 'insert_custom_field'), 'post', 'normal', 'core', array('cft_id' => $key));
-						elseif ( $options['custom_fields'][$key]['post_type']=='page' ) :
-							add_meta_box('cftdiv'.$i, $title, array(&$this, 'insert_custom_field'), 'page', 'normal', 'core', array('cft_id' => $key));
-						endif;
-					else :
-						$tmp_custom_post_type = explode(',', $options['custom_fields'][$key]['custom_post_type']);
-						$tmp_custom_post_type = array_filter( $tmp_custom_post_type );
-						$tmp_custom_post_type = array_unique(array_filter(array_map('trim', $tmp_custom_post_type)));
-						foreach ( $tmp_custom_post_type as $type ) :
-							add_meta_box('cftdiv'.$i, $title, array(&$this, 'insert_custom_field'), $type, 'normal', 'core', array('cft_id' => $key));
-						endforeach;
-					endif;
-					$i++;
-				endforeach;
-			endif;
-		else :
-			add_meta_box('cftdiv', __('Custom Field Template', 'custom-field-template'), array(&$this, 'insert_custom_field'), 'post', 'normal', 'core');
-			add_meta_box('cftdiv', __('Custom Field Template', 'custom-field-template'), array(&$this, 'insert_custom_field'), 'page', 'normal', 'core');
-		endif;
-
-		if ( empty($options['custom_field_template_deploy_box']) && is_array($options['custom_fields']) ) :
-			$custom_post_type = array();
-			foreach($options['custom_fields'] as $key => $val ) :
-				if ( isset($options['custom_fields'][$key]['custom_post_type']) ) :
-					$tmp_custom_post_type = explode(',', $options['custom_fields'][$key]['custom_post_type']);
-					$tmp_custom_post_type = array_filter( $tmp_custom_post_type );
-					$tmp_custom_post_type = array_unique(array_filter(array_map('trim', $tmp_custom_post_type)));
-					$custom_post_type = array_merge($custom_post_type, $tmp_custom_post_type);
-				endif;
-			endforeach;
-			if ( isset($custom_post_type) && is_array($custom_post_type) ) :
-				foreach( $custom_post_type as $val ) :
-					if ( function_exists('remove_meta_box') && !empty($options['custom_field_template_disable_default_custom_fields']) ) :
-						remove_meta_box('postcustom', $val, 'normal');
-					endif;
-					add_meta_box('cftdiv', __('Custom Field Template', 'custom-field-template'), array(&$this, 'insert_custom_field'), $val, 'normal', 'core');
-					if ( empty($options['custom_field_template_disable_custom_field_column']) ) :
-						add_filter( 'manage_'.$val.'_posts_columns', array(&$this, 'add_manage_pages_columns') );
-					endif;
-				endforeach;
-			endif;
-		endif;
-	}
-
-	function custom_field_template_attachment_fields_to_edit($form_fields, $post) {
-		$form_fields["custom_field_template"]["label"] = __('Media Picker', 'custom-field-template');
-		$form_fields["custom_field_template"]["input"] = "html";
-		$form_fields["custom_field_template"]["html"] = '<a href="javascript:void(0);" onclick="var win = window.dialogArguments || opener || parent || top;win.cft_use_this('.$post->ID.');return false;">'.__('Use this', 'custom-field-template').'</a>';
-
-		return $form_fields;
-	}
-
-	function custom_field_template_add_enctype($buffer) {
-		$buffer = preg_replace('/<form name="post"/', '<form enctype="multipart/form-data" name="post"', $buffer);
-		return $buffer;
-	}
-
-	function custom_field_template_admin_head_buffer() {
-		ob_start(array(&$this, 'custom_field_template_add_enctype'));
-	}
-
-	function custom_field_template_admin_footer_buffer() {
-		ob_end_flush();
-	}
-
-	function has_meta( $postid ) {
-		global $wpdb;
-
-		return $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value, meta_id, post_id FROM $wpdb->postmeta WHERE post_id = %d ORDER BY meta_key,meta_id", $postid), ARRAY_A );
-	}
-
-	function get_post_meta($post_id, $key = '', $single = false) {
-		if ( !$post_id ) return '';
-
-		if ( $preview_id = $this->get_preview_id( $post_id ) ) $post_id = $preview_id;
-
-		$post_id = (int) $post_id;
-
-		$meta_cache = wp_cache_get($post_id, 'cft_post_meta');
-
-		if ( !$meta_cache ) {
-			if ( $meta_list = $this->has_meta( $post_id ) ) {
-				foreach ( (array) $meta_list as $metarow) {
-					$mpid = (int) $metarow['post_id'];
-					$mkey = $metarow['meta_key'];
-					$mval = $metarow['meta_value'];
-
-					if ( !isset($cache[$mpid]) || !is_array($cache[$mpid]) )
-						$cache[$mpid] = array();
-					if ( !isset($cache[$mpid][$mkey]) || !is_array($cache[$mpid][$mkey]) )
-						$cache[$mpid][$mkey] = array();
-
-					$cache[$mpid][$mkey][] = $mval;
-				}
-			}
-
-			/*foreach ( (array) $ids as $id ) {
-				if ( ! isset($cache[$id]) )
-					$cache[$id] = array();
-			}*/
-
-			if ( !empty($cache) && is_array($cache) ) :
-				foreach ( (array) array_keys($cache) as $post)
-					wp_cache_set($post, $cache[$post], 'cft_post_meta');
-
-				$meta_cache = wp_cache_get($post_id, 'cft_post_meta');
-			endif;
-		}
-
-		if ( $key ) :
-			if ( $single && isset($meta_cache[$key][0]) ) :
-				return maybe_unserialize( $meta_cache[$key][0] );
-			else :
-				if ( isset($meta_cache[$key]) ) :
-					if ( is_array($meta_cache[$key]) ) :
-						return array_map('maybe_unserialize', $meta_cache[$key]);
-					else :
-						return $meta_cache[$key];
-					endif;
-				endif;
-			endif;
-		else :
-			if ( is_array($meta_cache) ) :
-				return array_map('maybe_unserialize', $meta_cache);
-			endif;
-		endif;
-
-		return '';
-	}
-
-	function add_quick_edit_custom_box($column_name, $type) {
-		if( $column_name == 'custom-fields' ) :
-			global $wp_version;
-			$options = $this->get_custom_field_template_data();
-
-			if( $options == null)
-				return;
-
-			if ( !$options['css'] ) {
-				$this->install_custom_field_template_css();
-				$options = $this->get_custom_field_template_data();
-			}
-
-			$out = '';
-			$out .= '<fieldset style="clear:both;">' . "n";
-			$out .= '<div class="inline-edit-group">';
-			$out .=	'<style type="text/css">' . "n" .
-					'<!--' . "n";
-			$out .=	esc_html( $options['css'] ) . "n";
-			$out .=	'-->' . "n" .
-					'</style>';
-
-			if ( count($options['custom_fields'])>1 ) {
-				$out .= '<select id="custom_field_template_select">';
-				for ( $i=0; $i < count($options['custom_fields']); $i++ ) {
-					if ( isset($_REQUEST['post']) && isset($options['posts'][$_REQUEST['post']]) && $i == $options['posts'][$_REQUEST['post']] ) {
-						$out .= '<option value="' . $i . '" selected="selected">' . esc_html(stripcslashes($options['custom_fields'][$i]['title'])) . '</option>';
-					} else
-						$out .= '<option value="' . $i . '">' . esc_html(stripcslashes($options['custom_fields'][$i]['title'])) . '</option>';
-				}
-				$out .= '</select>';
-				$out .= '<input type="button" class="button" value="' . __('Load', 'custom-field-template') . '" onclick="var post = jQuery(this).parent().parent().parent().parent().attr('id').replace('edit-',''); var cftloading_select = function() {jQuery.ajax({type: 'GET', url: '?page=custom-field-template/custom-field-template.php&cft_mode=ajaxload&id='+jQuery('#custom_field_template_select').val()+'&post='+post, success: function(html) {jQuery('#cft').html(html);}});};cftloading_select(post);" />';
-			}
-
-			$out .= '<input type="hidden" name="custom-field-template-verify-key" id="custom-field-template-verify-key" value="' . wp_create_nonce('custom-field-template') . '" />';
-			$out .= '<div id="cft" class="cft">';
-			$out .= '</div>';
-
-			$out .= '</div>' . "n";
-			$out .= '</fieldset>' . "n";
-
-			echo $out;
-		endif;
-	}
-
-	function custom_field_template_admin_head() {
-		global $wp_version, $post;
-		$options = $this->get_custom_field_template_data();
-
-		if ( !empty($options['custom_field_template_use_validation']) ) :
-			if( strstr($_SERVER['REQUEST_URI'], 'wp-admin/post-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/post.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/page-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/page.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/edit.php') || (is_object($post) && $post->post_type=='page') ) :
-?>
-<script type="text/javascript">
-// <![CDATA[
-	jQuery(document).ready(function() {
-		jQuery("#post").validate();
-	});
-//-->
-</script>
-<style type="text/css">
-<!--
-	label.error				{ color:#FF0000; }
--->
-</style>
-
-<?php
-			endif;
-		endif;
-
-		if ( substr($wp_version, 0, 3) >= '2.7' && is_user_logged_in() && ( strstr($_SERVER['REQUEST_URI'], 'wp-admin/edit.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/edit-pages.php') ) && !strstr($_SERVER['REQUEST_URI'], 'page=') ) {
-?>
-<script type="text/javascript">
-// <![CDATA[
-	jQuery(document).ready(function() {
-		jQuery('.hide-if-no-js-cft').show();
-		jQuery('.hide-if-js-cft').hide();
-
-		inlineEditPost.addEvents = function(r) {
-			r.each(function() {
-				var row = jQuery(this);
-				jQuery('a.editinline', row).click(function() {
-					inlineEditPost.edit(this);
-					post_id = jQuery(this).parent().parent().parent().parent().attr('id').replace('post-','');
-					inlineEditPost.cft_load(post_id);
-					return false;
-				});
-			});
-		}
-
-		inlineEditPost.save = function(id) {
-			if( typeof(id) == 'object' )
-				id = this.getId(id);
-
-			jQuery('table.widefat .inline-edit-save .waiting').show();
-
-			var params = {
-				action: 'inline-save',
-				post_type: <?php if ( substr($wp_version, 0, 3) >= '3.0' ) echo 'typenow'; else echo 'this.type'; ?>,
-				post_ID: id,
-				edit_date: 'true'
-			};
-
-			var fields = jQuery('#edit-'+id+' :input').fieldSerialize();
-			params = fields + '&' + jQuery.param(params);
-
-			// make ajax request
-			jQuery.post('admin-ajax.php', params,
-				function(r) {
-					jQuery('table.widefat .inline-edit-save .waiting').hide();
-
-					if (r) {
-						if ( -1 != r.indexOf('<tr') ) {
-							jQuery(inlineEditPost.what+id).remove();
-							jQuery('#edit-'+id).before(r).remove();
-
-							var row = jQuery(inlineEditPost.what+id);
-							row.hide();
-
-							if ( 'draft' == jQuery('input[name="post_status"]').val() )
-								row.find('td.column-comments').hide();
-
-							row.find('.hide-if-no-js').removeClass('hide-if-no-js');
-							jQuery('.hide-if-no-js-cft').show();
-							jQuery('.hide-if-js-cft').hide();
-
-							inlineEditPost.addEvents(row);
-							row.fadeIn();
-						} else {
-							r = r.replace( /<.[^<>]*?>/g, '' );
-							jQuery('#edit-'+id+' .inline-edit-save').append('<span class="error">'+r+'</span>');
-						}
-					} else {
-						jQuery('#edit-'+id+' .inline-edit-save').append('<span class="error">'+inlineEditL10n.error+'</span>');
-					}
-				}
-			, 'html');
-			return false;
-		}
-
-		jQuery('.editinline').click(function () {post_id = jQuery(this).parent().parent().parent().parent().attr('id').replace('post-',''); inlineEditPost.cft_load(post_id);});
-		inlineEditPost.cft_load = function (post_id) {
-			jQuery.ajax({type: 'GET', url: '?page=custom-field-template/custom-field-template.php&cft_mode=ajaxload&post='+post_id, success: function(html) {jQuery('#cft').html(html);}});
-		};
-	});
-//-->
-</script>
-<style type="text/css">
-<!--
-	div.cft_list p.key		{ font-weight:bold; margin: 0; }
-	div.cft_list p.value	{ margin: 0 0 0 10px; }
-	.cft-actions			{ visibility: hidden; padding: 2px 0 0; }
-	tr:hover .cft-actions	{ visibility: visible; }
-	.inline-edit-row fieldset label { display:inline; }
-	label.error				{ color:#FF0000; }
--->
-</style>
-<?php
-		}
-	}
-
-	function custom_field_template_admin_notices() {
-		$options = $this->get_custom_field_template_data();
-		$cft_admin_notices = get_transient( 'cft_admin_notices' );
-		$locale = get_locale();
-
-		if ( empty( $cft_admin_notices ) && empty( $options['custom_field_template_disable_donation'] ) ) :
-?>
-<div class="notice notice-info is-dismissible" id="cft_admin_notices">
-<?php
-			if ( $locale == 'ja' ) :
-?>
-<p><a href="https://www.cmswp.jp/" target="_blank"><?php _e( 'Please use CMSxWP Subsc, which is a collection of WordPress plugins useful for various businesses such as EC, membership site, reservation site, event site, attendance management, and so on.', 'custom-field-template' ); ?></a></p>
-<p><a href="https://www.wpcft.com/" target="_blank"><?php _e( 'We have finally published a manual site for the custom field template plugin. You can also use the custom field refinement search for posts in the admin panel. Please check here.', 'custom-field-template' ); ?></a></p>
-<?php
-			else :
-?>
-<p><a href="https://www.wpcft.com/" target="_blank"><?php _e( 'We have finally published a manual site for the custom field template plugin. You can also use the custom field refinement search for posts in the admin panel. Please check here.', 'custom-field-template' ); ?></a></p>
-<?php
-			endif;
-?>
-<button type="button" class="notice-dismiss"></button>
-<script type="text/javascript">
-// <![CDATA[
-	jQuery(document).ready(function() {
-		jQuery('#cft_admin_notices button').click(function(){jQuery('#cft_admin_notices').hide();jQuery.getJSON('<?php echo site_url(); ?>/wp-admin/admin-ajax.php', { action:'dismiss_admin_notices', _wpnonce:'<?php echo wp_create_nonce( 'cft_admin_notices' ); ?>' }); });
-	});
-//-->
-</script></div>
-<?php
-		endif;
-	}
-
-	function custom_field_template_dismiss_admin_notices() {
-		if ( !check_ajax_referer( 'cft_admin_notices' ) ) exit();
-
-		set_transient( 'cft_admin_notices', '1', 7 * DAY_IN_SECONDS );
-		//set_transient( 'cft_admin_notices', '1', 60 );
-	}
-
-	function custom_field_template_edit_form_advanced() {
-		global $wp_version;
-		$options = $this->get_custom_field_template_data();
-
-		if ( !empty($options['custom_field_template_deploy_box']) ) :
-			$suffix = '"+win.jQuery("#cft_current_template").val()+"';
-		else :
-			$suffix = '';
-		endif;
-
-		$out = '';
-		$out .= 	'<script type="text/javascript">' . "n" .
-					'// <![CDATA[' . "n";
-		$out .=		'function cft_use_this(file_id) {
-		var win = window.dialogArguments || opener || parent || top;
-		win.jQuery("#"+win.jQuery("#cft_clicked_id").val()+"_hide").val(file_id);
-		var fields = win.jQuery("#cft'.$suffix.' :input").fieldSerialize();
-		win.jQuery.ajax({type: "POST", url: "?page=custom-field-template/custom-field-template.php&cft_mode=ajaxsave&post="+win.jQuery('#post_ID').val()+"&custom-field-template-verify-key="+win.jQuery("#custom-field-template-verify-key").val(), data: fields, success: function() {win.jQuery.ajax({type: "GET", url: "?page=custom-field-template/custom-field-template.php&cft_mode=ajaxload&id="+win.jQuery("#cft_current_template").val()+"&post="+win.jQuery('#post_ID').val(), success: function(html) {win.jQuery("#cft'.$suffix.'").html(html);win.tb_remove();}});}});
-	}';
-
-		$out .=		'function qt_set(new_id) { eval("qt_"+new_id+" = new QTags('qt_"+new_id+"', '"+new_id+"', 'editorcontainer_"+new_id+"', 'more');");}';
-
-		$out .=     'function _edInsertContent(myField, myValue) {
-	var sel, startPos, endPos, scrollTop;
-
-	//IE support
-	if (document.selection) {
-		myField.focus();
-		sel = document.selection.createRange();
-		sel.text = myValue;
-		myField.focus();
-	}
-	//MOZILLA/NETSCAPE support
-	else if (myField.selectionStart || myField.selectionStart == "0") {
-		startPos = myField.selectionStart;
-		endPos = myField.selectionEnd;
-		scrollTop = myField.scrollTop;
-		myField.value = myField.value.substring(0, startPos)
-		              + myValue
-                      + myField.value.substring(endPos, myField.value.length);
-		myField.focus();
-		myField.selectionStart = startPos + myValue.length;
-		myField.selectionEnd = startPos + myValue.length;
-		myField.scrollTop = scrollTop;
-	} else {
-		myField.value += myValue;
-		myField.focus();
-	}
-}';
-
-		$out .= 	'function send_to_custom_field(h) {' . "n" .
-					'	if ( tmpFocus ) ed = tmpFocus;' . "n" .
-					'	else if ( typeof tinyMCE == "undefined" ) ed = document.getElementById("content");' . "n" .
-					'	else { ed = tinyMCE.get("content"); if(ed) {if(!ed.isHidden()) isTinyMCE = true;}}' . "n" .
-					'	if ( typeof tinyMCE != "undefined" && isTinyMCE && !ed.isHidden() ) {' . "n" .
-					'		ed.focus();' . "n" .
-					'		if ( tinymce.isIE && ed.windowManager.insertimagebookmark )' . "n" .
-					'			ed.selection.moveToBookmark(ed.windowManager.insertimagebookmark);' . "n" .
-					'		if ( h.indexOf("[caption") === 0 ) {' . "n" .
-					'			if ( ed.plugins.wpeditimage )' . "n" .
-					'				h = ed.plugins.wpeditimage._do_shcode(h);' . "n" .
-					'		} else if ( h.indexOf("[gallery") === 0 ) {' . "n" .
-					'			if ( ed.plugins.wpgallery )' . "n" .
-					'				h = ed.plugins.wpgallery._do_gallery(h);' . "n" .
-					'		} else if ( h.indexOf("[embed") === 0 ) {' . "n" .
-					'			if ( ed.plugins.wordpress )' . "n" .
-					'				h = ed.plugins.wordpress._setEmbed(h);' . "n" .
-					'		}' . "n" .
-					'		ed.execCommand("mceInsertContent", false, h);' . "n" .
-					'	} else {' . "n" .
-					'		if ( tmpFocus ) _edInsertContent(tmpFocus, h);' . "n" .
-					'		else edInsertContent(edCanvas, h);' . "n" .
-					'	}' . "n";
-
-					if ( empty($options['custom_field_template_use_multiple_insert']) ) {
-						$out .= '	tb_remove();' . "n" .
-								'	tmpFocus = undefined;' . "n" .
-								'	isTinyMCE = false;' . "n";
-					}
-
-		if ( substr($wp_version, 0, 3) < '3.3' ) :
-			$qt_position = 'jQuery('#editorcontainer_'+id).prev()';
-			$load_tinyMCE = 'tinyMCE.execCommand(' . "'mceAddControl'" . ',false, id);';
-		elseif ( substr($wp_version, 0, 3) < '3.9' ) :
-			$qt_position = 'jQuery('#qt_'+id+'_toolbar')';
-			$load_tinyMCE = 'var ed = new tinyMCE.Editor(id, tinyMCEPreInit.mceInit['content']); ed.render();';
-		else :
-			$qt_position = 'jQuery('#qt_'+id+'_toolbar')';
-			$load_tinyMCE = 'tinyMCE.execCommand(' . "'mceAddEditor'" . ', true, id);';
-		endif;
-
-		$out .=		'}' . "n" .
-					'jQuery(".thickbox").bind("click", function (e) {' . "n" .
-					'	tmpFocus = undefined;' . "n" .
-					'	isTinyMCE = false;' . "n" .
-					'});' . "n" .
-					'var isTinyMCE;' . "n" .
-					'var tmpFocus;' . "n" .
-					'function focusTextArea(id) {' . "n" .
-					'	jQuery(document).ready(function() {' . "n" .
-					'		if ( typeof tinyMCE != "undefined" ) {' . "n" .
-					'			var elm = tinyMCE.get(id);' . "n" .
-					'		}' . "n" .
-					'		if ( ! elm || elm.isHidden() ) {' . "n" .
-					'			elm = document.getElementById(id);' . "n" .
-					'			isTinyMCE = false;' . "n" .
-					'		}else isTinyMCE = true;' . "n" .
-					'		tmpFocus = elm' . "n" .
-					'		elm.focus();' . "n" .
-					'		if (elm.createTextRange) {' . "n" .
-					'			var range = elm.createTextRange();' . "n" .
-					'			range.move("character", elm.value.length);' . "n" .
-					'			range.select();' . "n" .
-					'		} else if (elm.setSelectionRange) {' . "n" .
-					'			elm.setSelectionRange(elm.value.length, elm.value.length);' . "n" .
-					'		}' . "n" .
-					'	});' . "n" .
-					'}' . "n" .
-					'function switchMode(id) {' . "n" .
-					'	var ed = tinyMCE.get(id);' . "n" .
-					'	if ( ! ed || ed.isHidden() ) {' . "n" .
-					'		document.getElementById(id).value = switchEditors.wpautop(document.getElementById(id).value);' . "n" .
-					'		if ( ed ) { '.$qt_position.'.hide(); ed.show(); }' . "n" .
-					'		else {'.$load_tinyMCE.'}' . "n" .
-					'	} else {' . "n" .
-					'		ed.hide(); '.$qt_position.'.show(); document.getElementById(id).style.color="#000000";' . "n" .
-					'	}' . "n" .
-					'}' . "n";
-
-		$out .=		'function thickbox(link) {' . "n" .
-					'	var t = link.title || link.name || null;' . "n" .
-					'	var a = link.href || link.alt;' . "n" .
-					'	var g = link.rel || false;' . "n" .
-					'	tb_show(t,a,g);' . "n" .
-					'	link.blur();' . "n" .
-					'	return false;' . "n" .
-					'}' . "n";
-		$out .=     '//--></script>';
-		$out .= '<input type="hidden" id="cft_current_template" value="" />';
-		$out .= '<input type="hidden" id="cft_clicked_id" value="" />';
-		$out .= '<input type="hidden" name="custom-field-template-verify-key" id="custom-field-template-verify-key" value="' . wp_create_nonce('custom-field-template') . '" />';
-
-		$out .=		'<style type="text/css">' . "n" .
-					'<!--' . "n";
-		$out .=		esc_html( $options['css'] ) . "n";
-		$out .=		'.editorcontainer { overflow:hidden; background:#FFFFFF; }
-.content { width:98%; }
-.editorcontainer .content { padding: 6px; line-height: 150%; border: 0 none; outline: none;	-moz-box-sizing: border-box;	-webkit-box-sizing: border-box;	-khtml-box-sizing: border-box; box-sizing: border-box; }
-.quicktags { border:1px solid #DFDFDF; border-collapse: separate; -moz-border-radius: 6px 6px 0 0; -webkit-border-top-right-radius: 6px; -webkit-border-top-left-radius: 6px; -khtml-border-top-right-radius: 6px; -khtml-border-top-left-radius: 6px; border-top-right-radius: 6px; border-top-left-radius: 6px; }
-.quicktags { padding: 0; margin-bottom: -1px; border-bottom-width:1px;	background-image: url("images/ed-bg.gif"); background-position: left top; background-repeat: repeat; }
-.quicktags div div { padding: 2px 4px 0; }
-.quicktags div div input { margin: 3px 1px 4px; line-height: 18px; display: inline-block; border-width: 1px; border-style: solid; min-width: 26px; padding: 2px 4px; font-size: 12px; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; background:#FFFFFF url(images/fade-butt.png) repeat-x scroll 0 -2px; overflow: visible; }' . "n";
-		$out .=		'-->' . "n" .
-					'</style>';
-		echo $out;
-	}
-
-	function add_manage_posts_custom_column($column_name, $post_id) {
-		$data = $this->get_post_meta($post_id);
-
-		if( is_array($data) && $column_name == 'custom-fields' ) :
-			$flag = 0;
-			$content = $output = '';
-			foreach($data as $key => $val) :
-				if ( is_protected_meta($key) ) continue;
-				$content .= '<p class="key">' . esc_html( $key ) . '</p>' . "n";
-				foreach($val as $val2) :
-					$val2 = htmlspecialchars($val2, ENT_QUOTES);
-					if ( $flag ) :
-						$content .= '<p class="value">' . $val2 . '</p>' . "n";
-					else :
-						if ( function_exists('mb_strlen') ) :
-							if ( mb_strlen($val2) > 50 ) :
-								$before_content = mb_substr($val2, 0, 50);
-								$after_content  = mb_substr($val2, 50);
-								$content .= '<p class="value">' . $before_content . '[[[break]]]' . '<p class="value">' . $after_content . '</p>' . "n";
-								$flag = 1;
-							else :
-								$content .= '<p class="value">' . $val2 . '</p>' . "n";
-							endif;
-						else :
-							if ( strlen($val2) > 50 ) :
-								$before_content = substr($val2, 0, 50);
-								$after_content  = substr($val2, 50);
-								$content .= '<p class="value">' . $before_content . '[[[break]]]' . '<p class="value">' . $after_content . '</p>' . "n";
-								$flag = 1;
-							else :
-								$content .= '<p class="value">' . $val2 . '</p>' . "n";
-							endif;
-						endif;
-					endif;
-				endforeach;
-			endforeach;
-			if ( $content ) :
-				$content = preg_replace('/([^n]+)n([^n]+)n([^n]+)n([^n]+)n([^$]+)/', '1234[[[break]]]5', $content);
-				@list($before, $after) = explode('[[[break]]]', $content, 2);
-				$after = preg_replace('/[[[break]]]/', '', $after);
-				$output .= '<div class="cft_list">';
-				$output .= balanceTags($before, true);
-				if ( $after ) :
-					$output .= '<span class="hide-if-no-js-cft"><a href="javascript:void(0);" onclick="jQuery(this).parent().next().show(); jQuery(this).parent().next().next().show(); jQuery(this).parent().hide();">... ' . __('read more', 'custom-field-template') . '</a></span>';
-					$output .= '<span class="hide-if-js-cft">' . balanceTags($after, true) . '</span>';
-					$output .= '<span style="display:none;"><a href="javascript:void(0);" onclick="jQuery(this).parent().prev().hide(); jQuery(this).parent().prev().prev().show(); jQuery(this).parent().hide();">[^]</a></span>';
-				endif;
-				$output .= '</div>';
-			else :
-				$output .= ' ';
-			endif;
-		endif;
-
-		if ( isset($output) ) echo $output;
-	}
-
-	function add_manage_posts_columns($columns) {
-		/*$new_columns = array();
-		foreach($columns as $key => $val) :
-			$new_columns[$key] = $val;
-			if ( $key == 'tags' )
-				$new_columns['custom-fields'] = __('Custom Fields', 'custom-field-template');
-		endforeach;*/
-
-		$columns['custom-fields'] = __('Custom Fields', 'custom-field-template');
-		return $columns;
-	}
-
-	function add_manage_pages_columns($columns) {
-		/*$new_columns = array();
-		foreach($columns as $key => $val) :
-			$new_columns[$key] = $val;
-			if ( $key == 'author' )
-				$new_columns['custom-fields'] = __('Custom Fields', 'custom-field-template');
-		endforeach;*/
-
-		$columns['custom-fields'] = __('Custom Fields', 'custom-field-template');
-		return $columns;
-	}
-
-	function media_send_to_custom_field($html) {
-		if ( strstr($_SERVER['REQUEST_URI'], 'wp-admin/admin-ajax.php') ) return $html;
-		$out =  '<script type="text/javascript">' . "n" .
-					'	/* <![CDATA[ */' . "n" .
-					'	var win = window.dialogArguments || opener || parent || top;' . "n" .
-					'   if ( typeof win.send_to_custom_field == "function" ) ' . "n" .
-					'	    win.send_to_custom_field("' . addslashes($html) . '");' . "n" .
-					'   else ' . "n" .
-					'       win.send_to_editor("' . addslashes($html) . '");' . "n" .
-					'/* ]]> */' . "n" .
-					'</script>' . "n";
-
-		echo $out;
-		exit();
-
-		/*if ($options['custom_field_template_use_multiple_insert']) {
-			return;
-		} else {
-			exit();
-		}*/
-	}
-
-	function wpaq_filter_plugin_actions($links, $file){
-		static $this_plugin;
-
-		if( ! $this_plugin ) $this_plugin = plugin_basename(__FILE__);
-
-		if( $file == $this_plugin ){
-			$settings_link = '<a href="options-general.php?page=custom-field-template.php">' . __('Settings') . '</a>';
-			$links = array_merge( array($settings_link), $links);
-		}
-		return $links;
-	}
-
-	function custom_field_template_admin_scripts() {
-		global $post, $wp_version;
-		$options = $this->get_custom_field_template_data();
-		$locale = get_locale();
-
-		if ( !defined('WP_PLUGIN_DIR') )
-			$plugin_dir = str_replace( ABSPATH, '', dirname(__FILE__) );
-		else
-			$plugin_dir = dirname( plugin_basename(__FILE__) );
-
-		wp_enqueue_script( 'jquery' );
-		if ( substr($wp_version, 0, 3) >= '5.5' ) :
-			wp_enqueue_script( 'jquery-migrate', '/'.PLUGINDIR.'/'.$plugin_dir.'/jquery-migrate-1.4.1.min.js', array('jquery'));
-		endif;
-		wp_enqueue_script( 'jquery-form' );
-		//wp_enqueue_script( 'bgiframe', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.bgiframe.js', array('jquery') ) ;
-		if (strpos($_SERVER['REQUEST_URI'], 'custom-field-template') !== false )
-			wp_enqueue_script( 'textarearesizer', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.textarearesizer.js', array('jquery') );
-		if( strstr($_SERVER['REQUEST_URI'], 'wp-admin/post-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/post.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/page-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/page.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/edit.php') || (is_object($post) && $post->post_type=='page') ) :
-			wp_enqueue_script('date', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/date.js', array('jquery') );
-			wp_enqueue_script('datePicker', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.datePicker.js', array('jquery') );
-			wp_enqueue_style('datePicker', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/datePicker.css' );
-			wp_enqueue_script('editor');
-			wp_enqueue_script('quicktags');
-
-			if ( !empty($options['custom_field_template_use_validation']) ) :
-				wp_enqueue_script( 'jquery-validate', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.validate.js', array('jquery') );
-				wp_enqueue_script( 'additional-methods', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/additional-methods.js', array('jquery') );
-				if ( file_exists(ABSPATH . PLUGINDIR . '/' . $plugin_dir . '/js/messages_' . $locale . '.js') )
-					wp_enqueue_script( 'messages_' . $locale, '/' . PLUGINDIR . '/' . $plugin_dir . '/js/messages_' . $locale .'.js', array('jquery') );
-			endif;
-		endif;
-
-	}
-
-	function install_custom_field_template_data() {
-		$options['custom_field_template_before_list'] = '<ul>';
-		$options['custom_field_template_after_list'] = '</ul>';
-		$options['custom_field_template_before_value'] = '<li>';
-		$options['custom_field_template_after_value'] = '</li>';
-		$options['custom_fields'][0]['title']   = __('Default Template', 'custom-field-template');
-		$options['custom_fields'][0]['content'] = '[Plan]
-type = text
-size = 35
-label = Where are you going to go?
-
-[Plan]
-type = textfield
-size = 35
-hideKey = true
-
-[Favorite Fruits]
-type = checkbox
-value = apple # orange # banana # grape
-default = orange # grape
-
-[Miles Walked]
-type = radio
-value = 0-9 # 10-19 # 20+
-default = 10-19
-clearButton = true
-
-[Temper Level]
-type = select
-value = High # Medium # Low
-default = Low
-
-[Hidden Thought]
-type = textarea
-rows = 4
-cols = 40
-tinyMCE = true
-htmlEditor = true
-mediaButton = true
-
-[File Upload]
-type = file';
-		$options['shortcode_format'][0] = '<table class="cft">
-<tbody>
-<tr>
-<th>Plan</th><td colspan="3">[Plan]</td>
-</tr>
-<tr>
-<th>Favorite Fruits</th><td>[Favorite Fruits]</td>
-<th>Miles Walked</th><td>[Miles Walked]</td>
-</tr>
-<tr>
-<th>Temper Level</th><td colspan="3">[Temper Level]</td>
-</tr>
-<tr>
-<th>Hidden Thought</th><td colspan="3">[Hidden Thought]</td>
-</tr>
-</tbody>
-</table>';
-		update_option('custom_field_template_data', $options);
-	}
-
-	function install_custom_field_template_css() {
-		$options = get_option('custom_field_template_data');
-		$options['css'] = '.cft { overflow:hidden; }
-.cft:after { content:" "; clear:both; height:0; display:block; visibility:hidden; }
-.cft dl { margin:10px 0; }
-.cft dl:after { content:" "; clear:both; height:0; display:block; visibility:hidden; }
-.cft dt { width:20%; clear:both; float:left; display:inline; font-weight:bold; text-align:center; }
-.cft dt .hideKey { visibility:hidden; }
-.cft dd { margin:0 0 0 21%; }
-.cft dd p.label { font-weight:bold; margin:0; }
-.cft_instruction { margin:10px; }
-.cft fieldset { border:1px solid #CCC; margin:5px; padding:5px; }
-.cft .dl_checkbox { margin:0; }
-';
-		update_option('custom_field_template_data', $options);
-	}
-
-
-	function get_custom_field_template_data() {
-		$options = get_option('custom_field_template_data');
-		if ( !empty($options) && !is_array($options) ) $options = array();
-		return $options;
-	}
-
-	function custom_field_template_admin_menu() {
-		$options = $this->get_custom_field_template_data();
-		add_options_page(__('Custom Field Template', 'custom-field-template'), __('Custom Field Template', 'custom-field-template'), 'manage_options', basename(__FILE__), array(&$this, 'custom_field_template_admin'));
-		if ( empty($options['custom_field_template_disable_admin_search']) ) :
-			//add_action('load-edit.php', array(&$this, 'custom_field_template_add_help_tab') );
-		endif;
-	}
-
-	function custom_field_template_add_help_tab() {
-		$screen = get_current_screen();
-
-	}
-
-	function custom_field_template_get_the_excerpt($excerpt) {
-		$options = $this->get_custom_field_template_data();
-
-		if ( empty($excerpt) ) $this->is_excerpt = true;
-		if ( !empty($options['custom_field_template_excerpt_shortcode']) ) return do_shortcode($excerpt);
-		else return $excerpt;
-	}
-
-	function custom_field_template_the_content($content) {
-		global $wp_query, $post, $shortcode_tags, $wp_version;
-		$options = $this->get_custom_field_template_data();
-
-		if ( isset($options['hook']) && count($options['hook']) > 0 ) :
-			$categories = get_the_category();
-			$cats = array();
-			foreach( $categories as $val ) :
-				$cats[] = $val->cat_ID;
-			endforeach;
-
-			for ( $i=0; $i<count($options['hook']); $i++ ) :
-
-				if ( $this->is_excerpt && empty($options['hook'][$i]['excerpt']) ) :
-					$this->is_excerpt = false;
-					$content = $post->post_excerpt ? $post->post_excerpt : strip_shortcodes($content);
-					$strip_shortcode = 1;
-					continue;
-				endif;
-
-				$options['hook'][$i]['content'] = stripslashes($options['hook'][$i]['content']);
-				if ( is_feed() && empty($options['hook'][$i]['feed']) ) break;
-				if ( !empty($options['hook'][$i]['category']) ) :
-					if ( is_category() || is_single() || is_feed() ) :
-						if ( !empty($options['hook'][$i]['use_php']) ) :
-							$options['hook'][$i]['content'] = $this->EvalBuffer(stripcslashes($options['hook'][$i]['content']));
-						endif;
-						$needle = explode(',', $options['hook'][$i]['category']);
-						$needle = array_filter($needle);
-						$needle = array_unique(array_filter(array_map('trim', $needle)));
-						foreach ( $needle as $val ) :
-							if ( in_array($val, $cats ) ) :
-								if ( $options['hook'][$i]['position'] == 0 ) :
-									$content .= $options['hook'][$i]['content'];
-								elseif ( $options['hook'][$i]['position'] == 2 ) :
-									$content = preg_replace('/[cfthook hook='.$i.']/', $options['hook'][$i]['content'], $content);
-								elseif ( $options['hook'][$i]['position'] == 3 ) :
-									$content = preg_replace('/(<span id="more-[0-9]+"></span>)/', $options['hook'][$i]['content']."$1", $content);
-								else :
-									$content = $options['hook'][$i]['content'] . $content;
-								endif;
-								break;
-							endif;
-						endforeach;
-					endif;
-				elseif ( $options['hook'][$i]['post_type']=='post' ) :
-					if ( is_single() ) :
-						if ( !empty($options['hook'][$i]['use_php']) ) :
-							$options['hook'][$i]['content'] = $this->EvalBuffer(stripcslashes($options['hook'][$i]['content']));
-						endif;
-						if ( $options['hook'][$i]['position'] == 0 ) :
-							$content .= $options['hook'][$i]['content'];
-						elseif ( $options['hook'][$i]['position'] == 2 ) :
-							$content = preg_replace('/[cfthook hook='.$i.']/', $options['hook'][$i]['content'], $content);
-						elseif ( $options['hook'][$i]['position'] == 3 ) :
-							$content = preg_replace('/(<span id="more-[0-9]+"></span>)/', $options['hook'][$i]['content']."$1", $content);
-						else :
-							$content = $options['hook'][$i]['content'] . $content;
-						endif;
-					endif;
-				elseif ( $options['hook'][$i]['post_type']=='page' ) :
-					if ( is_page() ) :
-						if ( !empty($options['hook'][$i]['use_php']) ) :
-							$options['hook'][$i]['content'] = $this->EvalBuffer(stripcslashes($options['hook'][$i]['content']));
-						endif;
-						if ( $options['hook'][$i]['position'] == 0 ) :
-							$content .= $options['hook'][$i]['content'];
-						elseif ( $options['hook'][$i]['position'] == 2 ) :
-							$content = preg_replace('/[cfthook hook='.$i.']/', $options['hook'][$i]['content'], $content);
-						elseif ( $options['hook'][$i]['position'] == 3 ) :
-							$content = preg_replace('/(<span id="more-[0-9]+"></span>)/', $options['hook'][$i]['content']."$1", $content);
-						else :
-							$content = $options['hook'][$i]['content'] . $content;
-						endif;
-					endif;
-				elseif ( $options['hook'][$i]['custom_post_type'] ) :
-					$custom_post_type = explode(',', $options['hook'][$i]['custom_post_type']);
-					$custom_post_type = array_filter( $custom_post_type );
-					$custom_post_type = array_map( 'trim', $custom_post_type );
-					if ( in_array($post->post_type, $custom_post_type) ) :
-						if ( !empty($options['hook'][$i]['use_php']) ) :
-							$options['hook'][$i]['content'] = $this->EvalBuffer(stripcslashes($options['hook'][$i]['content']));
-						endif;
-						if ( $options['hook'][$i]['position'] == 0 ) :
-							$content .= $options['hook'][$i]['content'];
-						elseif ( $options['hook'][$i]['position'] == 2 ) :
-							$content = preg_replace('/[cfthook hook='.$i.']/', $options['hook'][$i]['content'], $content);
-						elseif ( $options['hook'][$i]['position'] == 3 ) :
-							$content = preg_replace('/(<span id="more-[0-9]+"></span>)/', $options['hook'][$i]['content']."$1", $content);
-						else :
-							$content = $options['hook'][$i]['content'] . $content;
-						endif;
-					endif;
-				else :
-					if ( !empty($options['hook'][$i]['use_php']) ) :
-							$options['hook'][$i]['content'] = $this->EvalBuffer(stripcslashes($options['hook'][$i]['content']));
-					endif;
-					if ( $options['hook'][$i]['position'] == 0 ) :
-						$content .= $options['hook'][$i]['content'];
-					elseif ( $options['hook'][$i]['position'] == 2 ) :
-						$content = preg_replace('/[cfthook hook='.$i.']/', $options['hook'][$i]['content'], $content);
-					elseif ( $options['hook'][$i]['position'] == 3 ) :
-						$content = preg_replace('/(<span id="more-[0-9]+"></span>)/', $options['hook'][$i]['content']."$1", $content);
-					else :
-						$content = $options['hook'][$i]['content'] . $content;
-					endif;
-				endif;
-			endfor;
-			return !empty($strip_shortcode)? $content : do_shortcode($content);
-		else :
-			return $content;
-		endif;
-	}
-
-	function custom_field_template_check_premium_code( $premium_code, $functionality ) {
-		$host = $_SERVER['HTTP_HOST'];
-		if ( password_verify( $host.$functionality, $premium_code ) ) :
-			return 1;
-		else :
-			return 0;
-		endif;
-	}
-
-	function custom_field_template_check_authentication_key( $auth_key ) {
-		$request = wp_remote_get( 'https://www.wpcft.com/auth/?domain=' . $_SERVER['HTTP_HOST'] . '&auth_key=' . $auth_key );
-		if ( ! is_wp_error( $request ) && $request['response']['code'] == 200 ) :
-			if ( $request['body'] == 1 ) :
-				return true;
-			else :
-				return false;
-			endif;
-		else :
-			return false;
-		endif;
-	}
-
-	function custom_field_template_wp_list_table_class_name( $class_name, $args ) {
-		$options = $this->get_custom_field_template_data();
-		$adminsearch = isset( $options['premium_settings']['adminsearch'][$args['screen']->post_type] ) ? $options['premium_settings']['adminsearch'][$args['screen']->post_type] : '';
-		if ( ! empty( $options['custom_field_template_premium_code'] ) && $adminsearch != '' && strstr( $_SERVER['REQUEST_URI'], 'wp-admin/edit.php') ) :
-			return 'CFT_WP_Posts_List_Table';
-		else :
-			return $class_name;
-		endif;
-	}
-
-	function custom_field_template_admin() {
-		global $wp_version;
-		$locale = get_locale();
-
-		$options = $this->get_custom_field_template_data();
-
-		if ( !empty($_POST['_wpnonce']) ) :
-			if ( !wp_verify_nonce( $_POST['_wpnonce'], 'cft' ) ) :
-				$errormessage = __('Options were not updated.', 'custom-field-template');
-			else :
-				if( !empty($_POST["custom_field_template_set_options_submit"]) ) :
-					unset($options['custom_fields']);
-					$j = 0;
-					for($i=0;$i<count($_POST["custom_field_template_content"]);$i++) {
-						if( $_POST["custom_field_template_content"][$i] ) {
-							if ( preg_match('/[content]|[post_title]|[excerpt]|[action]/i', $_POST["custom_field_template_content"][$i]) ) :
-								$errormessage = __('You can not use the following words as the field key: `content`, `post_title`, and `excerpt`, and `action`.', 'custom-field-template');
-							endif;
-							if ( isset($_POST["custom_field_template_title"][$i]) ) $options['custom_fields'][$j]['title']   = $_POST["custom_field_template_title"][$i];
-							if ( isset($_POST["custom_field_template_content"][$i]) ) $options['custom_fields'][$j]['content'] = $_POST["custom_field_template_content"][$i];
-							if ( isset($_POST["custom_field_template_instruction"][$i]) ) $options['custom_fields'][$j]['instruction'] = $_POST["custom_field_template_instruction"][$i];
-							if ( isset($_POST["custom_field_template_category"][$i]) ) $options['custom_fields'][$j]['category'] = $_POST["custom_field_template_category"][$i];
-							if ( isset($_POST["custom_field_template_post"][$i]) ) $options['custom_fields'][$j]['post'] = $_POST["custom_field_template_post"][$i];
-							if ( isset($_POST["custom_field_template_post_type"][$i]) ) $options['custom_fields'][$j]['post_type'] = $_POST["custom_field_template_post_type"][$i];
-							if ( isset($_POST["custom_field_template_custom_post_type"][$i]) ) $options['custom_fields'][$j]['custom_post_type'] = $_POST["custom_field_template_custom_post_type"][$i];
-							if ( isset($_POST["custom_field_template_template_files"][$i]) ) $options['custom_fields'][$j]['template_files'] = $_POST["custom_field_template_template_files"][$i];
-							if ( isset($_POST["custom_field_template_user_id"][$i]) ) $options['custom_fields'][$j]['user_id'] = $_POST["custom_field_template_user_id"][$i];
-							if ( isset($_POST["custom_field_template_user_login"][$i]) ) $options['custom_fields'][$j]['user_login'] = $_POST["custom_field_template_user_login"][$i];
-							if ( isset($_POST["custom_field_template_user_role"][$i]) ) $options['custom_fields'][$j]['user_role'] = $_POST["custom_field_template_user_role"][$i];
-							if ( isset($_POST["custom_field_template_disable"][$i]) ) $options['custom_fields'][$j]['disable'] = $_POST["custom_field_template_disable"][$i];
-							$options['custom_fields'][$j]['format'] = isset($_POST["custom_field_template_format"][$i]) ? $_POST["custom_field_template_format"][$i] : '';
-							$j++;
-						}
-					}
-					update_option('custom_field_template_data', $options);
-					$message = __('Options updated.', 'custom-field-template');
-				elseif( !empty($_POST["custom_field_template_global_settings_submit"]) ) :
-					$options['custom_field_template_replace_keys_by_labels'] = isset($_POST['custom_field_template_replace_keys_by_labels']) ? 1 : '';
-					$options['custom_field_template_use_multiple_insert'] = isset($_POST['custom_field_template_use_multiple_insert']) ? 1 : '';
-					$options['custom_field_template_use_wpautop'] = isset($_POST['custom_field_template_use_wpautop']) ? 1 : '';
-					$options['custom_field_template_use_autosave'] = isset($_POST['custom_field_template_use_autosave']) ? 1 : '';
-					$options['custom_field_template_use_disable_button'] = isset($_POST['custom_field_template_use_disable_button']) ? 1 : '';
-					$options['custom_field_template_disable_initialize_button'] = isset($_POST['custom_field_template_disable_initialize_button']) ? 1 : '';
-					$options['custom_field_template_disable_save_button'] = isset($_POST['custom_field_template_disable_save_button']) ? 1 : '';
-					$options['custom_field_template_disable_default_custom_fields'] = isset($_POST['custom_field_template_disable_default_custom_fields']) ? 1 : '';
-					$options['custom_field_template_disable_quick_edit'] = isset($_POST['custom_field_template_disable_quick_edit']) ? 1 : '';
-					$options['custom_field_template_disable_admin_search'] = isset($_POST['custom_field_template_disable_admin_search']) ? 1 : '';
-					$options['custom_field_template_disable_custom_field_column'] = isset($_POST['custom_field_template_disable_custom_field_column']) ? 1 : '';
-					$options['custom_field_template_replace_the_title'] = isset($_POST['custom_field_template_replace_the_title']) ? 1 : '';
-					$options['custom_field_template_deploy_box'] = isset($_POST['custom_field_template_deploy_box']) ? 1 : '';
-					if ( !empty($options['custom_field_template_deploy_box']) ) :
-						$options['css'] = preg_replace('/#cft /', '.cft ', $options['css']);
-						$options['css'] = preg_replace('/#cft_/', '.cft_', $options['css']);
-					endif;
-					$options['custom_field_template_widget_shortcode'] = isset($_POST['custom_field_template_widget_shortcode']) ? 1 : '';
-					$options['custom_field_template_excerpt_shortcode'] = isset($_POST['custom_field_template_excerpt_shortcode']) ? 1 : '';
-					$options['custom_field_template_use_validation'] = isset($_POST['custom_field_template_use_validation']) ? 1 : '';
-					$options['custom_field_template_before_list'] = isset($_POST['custom_field_template_before_list']) ? $_POST['custom_field_template_before_list'] : '';
-					$options['custom_field_template_after_list'] = isset($_POST['custom_field_template_after_list']) ? $_POST['custom_field_template_after_list'] : '';
-					$options['custom_field_template_before_value'] = isset($_POST['custom_field_template_before_value']) ? $_POST['custom_field_template_before_value'] : '';
-					$options['custom_field_template_after_value'] = isset($_POST['custom_field_template_after_value']) ? $_POST['custom_field_template_after_value'] : '';
-					$options['custom_field_template_replace_keys_by_labels'] = isset($_POST['custom_field_template_replace_keys_by_labels']) ? 1 : '';
-					$options['custom_field_template_replace_keys_by_labels'] = isset($_POST['custom_field_template_replace_keys_by_labels']) ? 1 : '';
-					$options['custom_field_template_replace_keys_by_labels'] = isset($_POST['custom_field_template_replace_keys_by_labels']) ? 1 : '';
-					$options['custom_field_template_output_direct_meta'] = isset($_POST['custom_field_template_output_direct_meta']) ? 1 : '';
-					$options['custom_field_template_output_protected_meta'] = isset($_POST['custom_field_template_output_protected_meta']) ? 1 : '';
-					$options['custom_field_template_disable_ad'] = isset($_POST['custom_field_template_disable_ad']) ? 1 : '';
-					$options['custom_field_template_disable_donation'] = isset($_POST['custom_field_template_disable_donation']) ? 1 : '';
-					update_option('custom_field_template_data', $options);
-					$message = __('Options updated.', 'custom-field-template');
-				elseif( !empty($_POST["custom_field_template_premium_settings_submit"]) ) :
-					if ( ! empty( $_POST['custom_field_template_premium_code'] ) ) :
-						$check_value = $this->custom_field_template_check_authentication_key( $_POST['custom_field_template_premium_code'] );
-						if ( $check_value == false ) :
-							$custom_field_template_premium_code = '';
-						else :
-							$custom_field_template_premium_code = sanitize_text_field( $_POST['custom_field_template_premium_code'] );
-						endif;
-						$options['custom_field_template_premium_code'] = $custom_field_template_premium_code;
-						if ( ! empty( $_POST["adminsearch"] ) ) :
-							foreach( $_POST["adminsearch"] as $key => $val ) :
-								if( isset( $val ) && is_numeric( $val ) ) :
-									$options['premium_settings']['adminsearch'][$key] = $val;
-								endif;
-							endforeach;
-						endif;
-						update_option('custom_field_template_data', $options);
-						$message = __('Options updated.', 'custom-field-template');
-					endif;
-				elseif ( !empty($_POST['custom_field_template_css_submit']) ) :
-					$options['css'] = $_POST['custom_field_template_css'];
-					update_option('custom_field_template_data', $options);
-					$message = __('Options updated.', 'custom-field-template');
-				elseif ( !empty($_POST['custom_field_template_shortcode_format_submit']) ) :
-					unset($options['shortcode_format'], $options['shortcode_format_use_php']);
-					$j = 0;
-					for($i=0;$i<count($_POST["custom_field_template_shortcode_format"]);$i++) {
-						if( !empty($_POST["custom_field_template_shortcode_format"][$i]) ) :
-							$options['shortcode_format'][$j] = $_POST["custom_field_template_shortcode_format"][$i];
-							$options['shortcode_format_use_php'][$j] = isset($_POST["custom_field_template_shortcode_format_use_php"][$i]) ? $_POST["custom_field_template_shortcode_format_use_php"][$i] : '';
-							$j++;
-						endif;
-					}
-					update_option('custom_field_template_data', $options);
-					$message = __('Options updated.', 'custom-field-template');
-				elseif ( !empty($_POST['custom_field_template_php_submit']) ) :
-					unset($options['php']);
-					for($i=0;$i<count($_POST["custom_field_template_php"]);$i++) {
-						if( !empty($_POST["custom_field_template_php"][$i]) )
-							$options['php'][] = $_POST["custom_field_template_php"][$i];
-					}
-					update_option('custom_field_template_data', $options);
-					$message = __('Options updated.', 'custom-field-template');
-				elseif( !empty($_POST["custom_field_template_hook_submit"]) ) :
-					unset($options['hook']);
-					$j = 0;
-					for($i=0;$i<count($_POST["custom_field_template_hook_content"]);$i++) {
-						if( $_POST["custom_field_template_hook_content"][$i] ) {
-							$options['hook'][$j]['position'] = !empty($_POST["custom_field_template_hook_position"][$i]) ? $_POST["custom_field_template_hook_position"][$i] : '';
-							$options['hook'][$j]['content']  = $_POST["custom_field_template_hook_content"][$i];
-							$options['hook'][$j]['custom_post_type'] = preg_replace('/s/', '', $_POST["custom_field_template_hook_custom_post_type"][$i]);
-							$options['hook'][$j]['category'] = preg_replace('/s/', '', $_POST["custom_field_template_hook_category"][$i]);
-							$options['hook'][$j]['use_php']  = !empty($_POST["custom_field_template_hook_use_php"][$i]) ? $_POST["custom_field_template_hook_use_php"][$i] : '';
-							$options['hook'][$j]['feed']  = !empty($_POST["custom_field_template_hook_feed"][$i]) ? $_POST["custom_field_template_hook_feed"][$i] : '';
-							$options['hook'][$j]['post_typ

Frequently Asked Questions

How Atomic Edge Works

Simple Setup. Powerful Security.

Atomic Edge acts as a security layer between your website & the internet. Our AI inspection and analysis engine auto blocks threats before traditional firewall services can inspect, research and build archaic regex filters.

Get Started

Trusted by Developers & Organizations

Trusted by Developers
Blac&kMcDonaldCovenant House TorontoAlzheimer Society CanadaUniversity of TorontoHarvard Medical School