dongqiangteng7319 2015-08-15 10:35 采纳率: 0%
浏览 112
已采纳

如何从我的Wordpress插件中保存设置?

I'm currently making a wordpress plugin with a settings page, where the user can input images, names and URL's which will then be shown on the website using a widget and a shortcode. Of course, I want to save these settings so they can be shown on the website. I have found this code, but I don't know if it is the (best) way:

<form method="post" action="options.php">
    <?php wp_nonce_field('update-options') ?>
    <p><strong>One 1:</strong><br />
        <input type="text" placeholder="Name" name="name" size="45" value="<?php echo get_option('name'); ?>" />
        <input type="text" placeholder="Logo" name="logo" size="45" value="<?php echo get_option('logo'); ?>" />
        <input type="text" placeholder="Website" name="website" size="45" value="<?php echo get_option('website'); ?>" />
    </p>
    <input type="submit" name="Submit" value="Save" /></p>
    <input type="hidden" name="action" value="update" />
    <input type="hidden" name="page_options" value="name, logo, website" />
</form>

What do you suggest?

  • 写回答

1条回答 默认 最新

  • douzhuo8312 2015-08-15 11:44
    关注

    read the Settings API from Wordpress, there is all you need to create an option page.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)