Php 在post_meta wordpress中保存表单值
我是wordpress自定义的新手,所以我不知道如何在wordpress表中保存数据。我正在自定义管理菜单中创建此表单,并希望在post_meta中保存数据。我可以如何做任何帮助Php 在post_meta wordpress中保存表单值,php,mysql,wordpress,Php,Mysql,Wordpress,我是wordpress自定义的新手,所以我不知道如何在wordpress表中保存数据。我正在自定义管理菜单中创建此表单,并希望在post_meta中保存数据。我可以如何做任何帮助 提前感谢如果您想保存需要使用的全局数据,post\u meta的数据将链接到特定的帖子。您可以为此使用Wordpress Ajax功能: 使用update_选项保存数据,并使用get_选项函数读取数据。这是单一许可证的场景 如果您想创建许可证集合,就像例如POST一样,您必须创建新的许可证集合。然后,您将拥有新帖子类型
提前感谢如果您想保存需要使用的全局数据,post\u meta的数据将链接到特定的帖子。您可以为此使用Wordpress Ajax功能: 使用update_选项保存数据,并使用get_选项函数读取数据。这是单一许可证的场景
如果您想创建许可证集合,就像例如POST一样,您必须创建新的许可证集合。然后,您将拥有新帖子类型中的帖子id,您可以使用update_post_meta和get_post_meta。函数dwwp_meta_save{if isset$_post['title']{update_option'title',$_post['title'];$value=$_post['title']}
function yummy_sounds_custom(){
add_menu_page(
__( 'Custom Menu Title', 'textdomain' ),
'Licence',
'manage_options',
'licence',
'licence_fields',
'',
6
);
}
add_action( 'admin_menu', 'yummy_sounds_custom' );
/**
* Display a custom menu page
*/
function licence_fields() {
?>
<h2>Fill the licence details</h2>
<form method="post" action="">
<div>Licence Title :</br> <input type="text" name="title" /></div>
<div>Licence Tagline :</br> <input type="text" name="tagline" /></div>
<div>Price :</br> <input type="text" name="price" /></div>
<div>Currency Symbol :</br> <input type="text" name="symbol" /></div>
<div>Description :</br> <textarea rows="7" cols="50" name="description"></textarea></div>
<div><input type="submit" value="Submit" name="submit"></div>
</form>