wordpress 添加自定义字段到 文章

$my_post          = array(
		'post_title'    => $publication_name,
		'post_excerpt'  => $publication_name,
		'post_date'     => '2019-04-30 09:00:00',
		'post_date_gmt' => '2019-04-30 09:00:00',
		'post_content'  => $publication_name,
		'post_status'   => 'publish',
		'post_author'   => 1,
		'meta_input' => array(
			'publication_name' => $publication_name,
			'postal_code' => $postal_code,
			'postal_code' => $postal_code,
			'frequency' => $frequency,
			'issn' => $issn,
			'rack_number' => $rack_number
		),
		'post_category' => array( 15 )   //  文章所在分类 ID
	);
	$mydata[]         = $my_post;
	wp_insert_post( $my_post,$wp_error = true);

 

你可能感兴趣的:(wordpress)