مثلا بصورت ساده یک پست تایپ ایجاد می کنیم:
function newsletter_post_type() {
register_post_type( 'newsletter',
array(
'labels' => array(
'name' => __( 'خبرنامه' ),
'singular_name' => __( 'خبرنامه' )
),
'public' => true,
'has_archive' => true,
)
);
}
add_action( 'init', 'newsletter_post_type' );
کد گفته شده رو به این صورت تغییر میدیم:
add_action('wp_ajax_form', 'form');
add_action('wp_ajax_nopriv_form', 'form');
function form() {
$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$text = $name . ' عزیز