{"id":12372074,"date":"2026-03-16T08:47:03","date_gmt":"2026-03-16T00:47:03","guid":{"rendered":"https:\/\/www.likacloud.com\/knowledge\/wordpress%e6%8f%92%e4%bb%b6%e5%bc%80%e5%8f%91%e5%ae%8c%e5%85%a8%e6%8c%87%e5%8d%97%ef%bc%9a%e4%bb%8e%e9%9b%b6%e5%88%b0%e4%b8%80%e6%9e%84%e5%bb%ba%e8%87%aa%e5%ae%9a%e4%b9%89%e5%8a%9f%e8%83%bd\/"},"modified":"2026-06-04T12:23:32","modified_gmt":"2026-06-04T04:23:32","slug":"wordpress-plugin-development-guide-from-scratch-12372074","status":"publish","type":"knowledge_post","link":"https:\/\/www.likacloud.com\/ja\/knowledge\/wordpress\/wordpress-plugin-development-guide-from-scratch-12372074\/","title":{"rendered":"WordPress\u30d7\u30e9\u30b0\u30a4\u30f3\u958b\u767a\u5b8c\u5168\u30ac\u30a4\u30c9\uff1a\u30bc\u30ed\u304b\u3089\u30ab\u30b9\u30bf\u30e0\u6a5f\u80fd\u306e\u69cb\u7bc9\u307e\u3067"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u51c6\u5907\u5de5\u4f5c\u4e0e\u73af\u5883\u642d\u5efa<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u5f00\u59cb\u7f16\u5199\u4ee3\u7801\u4e4b\u524d\uff0c\u4e00\u4e2a\u7a33\u5b9a\u4e14\u4e13\u4e1a\u7684\u5f00\u53d1\u73af\u5883\u662f\u6210\u529f\u7684\u57fa\u7840\u3002\u8fd9\u4e0d\u4ec5\u80fd\u63d0\u9ad8\u4f60\u7684\u7f16\u7801\u6548\u7387\uff0c\u4e5f\u80fd\u786e\u4fdd\u63d2\u4ef6\u5728\u4e0d\u540c\u73af\u5883\u4e0b\u7684\u517c\u5bb9\u6027\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u672c\u5730\u5f00\u53d1\u73af\u5883\u914d\u7f6e<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u63a8\u8350\u4f7f\u7528\u672c\u5730\u670d\u52a1\u5668\u73af\u5883\u5957\u4ef6\uff0c\u5982 Local by Flywheel\u3001XAMPP \u6216 MAMP\u3002\u8fd9\u4e9b\u5de5\u5177\u53ef\u4ee5\u4e00\u952e\u5b89\u88c5 Apache\u3001MySQL \u548c PHP\uff0c\u5b8c\u7f8e\u6a21\u62df\u7ebf\u4e0a\u670d\u52a1\u5668\u73af\u5883\u3002\u8bf7\u786e\u4fdd\u4f60\u7684 PHP \u7248\u672c\u4e0e\u76ee\u6807 WordPress \u7248\u672c\u7684\u8981\u6c42\u76f8\u5339\u914d\uff0c\u901a\u5e38\u5efa\u8bae\u4f7f\u7528 PHP 7.4 \u6216\u66f4\u9ad8\u7248\u672c\u4ee5\u83b7\u5f97\u66f4\u597d\u7684\u6027\u80fd\u548c\u5b89\u5168\u6027\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u4ee3\u7801\u7f16\u8f91\u5668\u4e0e\u5de5\u5177\u9009\u62e9<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u4ee3\u7801\u7f16\u8f91\u5668\u81f3\u5173\u91cd\u8981\u3002Visual Studio Code\u3001PhpStorm \u6216 Sublime Text \u90fd\u662f\u4f18\u79c0\u7684\u9009\u62e9\uff0c\u5b83\u4eec\u63d0\u4f9b\u8bed\u6cd5\u9ad8\u4eae\u3001\u4ee3\u7801\u63d0\u793a\u548c\u8c03\u8bd5\u529f\u80fd\u3002\u6b64\u5916\uff0c\u5b89\u88c5\u7248\u672c\u63a7\u5236\u5de5\u5177 Git \u662f\u7ba1\u7406\u4ee3\u7801\u53d8\u66f4\u3001\u56e2\u961f\u534f\u4f5c\u548c\u5907\u4efd\u7684\u884c\u4e1a\u6807\u51c6\u3002<\/p>\n<!-- AUTO_INTERNAL_LINKS_START --><p>\u63a8\u8350\u9605\u8bfb <a href=\"https:\/\/www.likacloud.com\/es\/knowledge\/wordpress\/wordpress-plugin-development-ultimate-guide-from-beginner-to-pro\/\">WordPress\u63d2\u4ef6\u5f00\u53d1\u7ec8\u6781\u6307\u5357\uff1a\u4ece\u5165\u95e8\u5230\u5b9e\u6218\u7684\u7cbe\u901a\u4e4b\u8def<\/a>\u3002<\/p><!-- AUTO_INTERNAL_LINKS_END -->\n\n\n\n\n<h2 class=\"wp-block-heading\">\u521b\u5efa\u4f60\u7684\u7b2c\u4e00\u4e2a\u63d2\u4ef6\u6587\u4ef6<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e00\u4e2a WordPress \u63d2\u4ef6\u6700\u6838\u5fc3\u7684\u90e8\u5206\u5c31\u662f\u5176\u4e3b\u6587\u4ef6\u3002\u8fd9\u4e2a\u6587\u4ef6\u4e0d\u4ec5\u5305\u542b\u63d2\u4ef6\u7684\u6267\u884c\u4ee3\u7801\uff0c\u8fd8\u901a\u8fc7\u7279\u5b9a\u7684\u6587\u4ef6\u5934\u6ce8\u91ca\u5411 WordPress \u7cfb\u7edf\u58f0\u660e\u63d2\u4ef6\u7684\u5143\u4fe1\u606f\u3002<\/p>\n<!-- AUTO_SYNCED_PATTERN_INSERT_START -->\n\r\n<div class=\"flex justify-between items-center flex-col lg:flex-row xl:flex-col 2xl:flex-row gap-6 sm:gap-8 rounded-lg border border-gray-200 dark:border-gray-700 p-4 mb-8 lg:mb-10 sm:p-6 bg-white dark:bg-gray-750 shadow-md transition-colors duration-300\"\r\n     data-link=\"https:\/\/www.likacloud.com\/ja\/tolink\/ultahost-wordpress-hosting\/\">\r\n     \r\n  <div class=\"flex flex-col gap-3 gap-4 sm:gap-6 w-full\">\r\n    <strong class=\"text-2xl font-semibold text-gray-900 dark:text-gray-200\">\r\n      UltaHost WordPress \u4e3b\u673a    <\/strong>\r\n    <div class=\"text-gray-600 dark:text-gray-300 word-word\">30\u5929\u9000\u6b3e\u4fdd\u8bc1\uff0c\u65e0\u9650\u5e26\u5bbd\u4e0e\u6570\u636e\u5e93\uff0c\u514d\u8d39\u7684 DDoS \u9632\u62a4\uff0c\u8d2d\u4e703\u5e74\u4f18\u60e050%<\/div>\r\n  <\/div>\r\n\r\n  <div class=\"flex items-center flex-col md:flex-row lg:flex-col xl:flex-row 2xl:flex-col gap-6 shrink-0\">\r\n          <a href=\"https:\/\/www.likacloud.com\/ja\/tolink\/ultahost-wordpress-hosting\/\">\r\n                  <img decoding=\"async\" src=\"https:\/\/www.likacloud.com\/wp-content\/uploads\/2025\/12\/20251227020448.webp\" alt=\"UltaHost LOGO\" class=\"content-promotion-card-icon h-9 min-h-9 dark:hidden\" title=\"\">\r\n          <img decoding=\"async\" src=\"https:\/\/www.likacloud.com\/wp-content\/uploads\/2025\/12\/20251229052118.webp\" alt=\"UltaHost LOGO\" class=\"content-promotion-card-icon h-9 min-h-9 hidden dark:block\" title=\"\">\r\n              <\/a>\r\n    \r\n    <a href=\"https:\/\/www.likacloud.com\/ja\/tolink\/ultahost-wordpress-hosting\/\"\r\n       class=\"bg-blue-500 w-full md:w-auto lg:w-full xl:w-auto 2xl:w-full text-center !text-white dark:!text-gray-200 !px-5 !py-1.5 rounded-full hover:bg-blue-600 transition-colors\">\r\n       \u8bbf\u95ee\u9875\u9762    <\/a>\r\n  <\/div>\r\n<\/div>\n<!-- AUTO_SYNCED_PATTERN_INSERT_END -->\n\n\n\n\n\n<h3 class=\"wp-block-heading\">\u63d2\u4ef6\u4e3b\u6587\u4ef6\u7684\u7ed3\u6784<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u6bcf\u4e2a\u63d2\u4ef6\u90fd\u5fc5\u987b\u6709\u4e00\u4e2a\u4e3b PHP \u6587\u4ef6\u3002\u6211\u4eec\u901a\u5e38\u4ee5\u63d2\u4ef6\u529f\u80fd\u6765\u547d\u540d\u8fd9\u4e2a\u6587\u4ef6\uff0c\u4f8b\u5982 <code>my-first-plugin.php<\/code>\u3002\u6587\u4ef6\u7684\u5f00\u5934\u5fc5\u987b\u5305\u542b\u6807\u51c6\u7684\u63d2\u4ef6\u5934\u6ce8\u91ca\uff0c\u8fd9\u662f WordPress \u8bc6\u522b\u63d2\u4ef6\u7684\u5173\u952e\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-php\">&lt;?php\n\/**\n * Plugin Name: \u6211\u7684\u7b2c\u4e00\u4e2a\u81ea\u5b9a\u4e49\u63d2\u4ef6\n * Plugin URI:  https:\/\/example.com\/my-first-plugin\n * Description: \u8fd9\u662f\u4e00\u4e2a\u7528\u4e8e\u6f14\u793a\u7684 WordPress \u81ea\u5b9a\u4e49\u63d2\u4ef6\u3002\n * Version:     1.0.0\n * Author:      \u4f60\u7684\u540d\u5b57\n * Author URI:  https:\/\/example.com\n * License:     GPL v2 or later\n * Text Domain: my-first-plugin\n *\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u6bb5\u6ce8\u91ca\u544a\u8bc9 WordPress \u5728\u540e\u53f0\u7684\u201c\u63d2\u4ef6\u201d\u9875\u9762\u4e2d\u663e\u793a\u63d2\u4ef6\u7684\u540d\u79f0\u3001\u63cf\u8ff0\u7b49\u4fe1\u606f\u3002\u5176\u4e2d <code>Text Domain<\/code> \u7528\u4e8e\u56fd\u9645\u5316\uff0c\u4e3a\u540e\u7eed\u7684\u7ffb\u8bd1\u5de5\u4f5c\u505a\u51c6\u5907\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u6fc0\u6d3b\u4e0e\u505c\u7528\u63d2\u4ef6<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u521b\u5efa\u4e3b\u6587\u4ef6\u540e\uff0c\u4f60\u9700\u8981\u5c06\u5176\u653e\u5165 WordPress \u5b89\u88c5\u76ee\u5f55\u4e0b\u7684 <code>\/wp-content\/plugins\/<\/code> \u6587\u4ef6\u5939\u4e2d\u3002\u53ef\u4ee5\u5355\u72ec\u653e\u7f6e\uff0c\u4e5f\u53ef\u4ee5\u4e3a\u5176\u521b\u5efa\u4e00\u4e2a\u4e13\u5c5e\u76ee\u5f55\uff08\u5982 <code>\/wp-content\/plugins\/my-first-plugin\/<\/code>\uff09\uff0c\u518d\u5c06\u4e3b\u6587\u4ef6\u653e\u5165\u5176\u4e2d\u3002\u5b8c\u6210\u540e\uff0c\u767b\u5f55 WordPress \u540e\u53f0\uff0c\u8fdb\u5165\u201c\u63d2\u4ef6\u201d\u9875\u9762\uff0c\u4f60\u5c31\u80fd\u770b\u5230\u65b0\u63d2\u4ef6\u5e76\u70b9\u51fb\u201c\u542f\u7528\u201d\u4e86\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u7406\u89e3 WordPress \u6838\u5fc3\u673a\u5236\uff1a\u94a9\u5b50\u4e0e\u8fc7\u6ee4\u5668<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">WordPress \u7684\u5f3a\u5927\u548c\u7075\u6d3b\u6027\u5f88\u5927\u7a0b\u5ea6\u4e0a\u6e90\u4e8e\u5176\u201c\u94a9\u5b50\uff08Hooks\uff09\u201d\u7cfb\u7edf\u3002\u63d2\u4ef6\u901a\u8fc7\u201c\u6302\u8f7d\u201d\u5230\u8fd9\u4e9b\u94a9\u5b50\u4e0a\uff0c\u5728\u4e0d\u4fee\u6539\u6838\u5fc3\u4ee3\u7801\u7684\u524d\u63d0\u4e0b\u6539\u53d8\u6216\u589e\u52a0 WordPress \u7684\u884c\u4e3a\u3002<\/p>\n<!-- AUTO_INTERNAL_LINKS_START --><p>\u63a8\u8350\u9605\u8bfb <a href=\"https:\/\/www.likacloud.com\/es\/knowledge\/wordpress\/wordpress-plugin-development-tutorial-custom-function-extension\/\">\u6df1\u5165\u89e3\u6790WordPress\u63d2\u4ef6\u5f00\u53d1\uff1a\u4ece\u96f6\u6784\u5efa\u81ea\u5b9a\u4e49\u529f\u80fd\u6269\u5c55<\/a>\u3002<\/p><!-- AUTO_INTERNAL_LINKS_END -->\n\n\n\n\n<h3 class=\"wp-block-heading\">\u52a8\u4f5c\u94a9\u5b50\u7684\u4f7f\u7528<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u52a8\u4f5c\u94a9\u5b50\uff08Action Hooks\uff09\u5141\u8bb8\u4f60\u5728\u7279\u5b9a\u7684\u65f6\u95f4\u70b9\u6267\u884c\u81ea\u5b9a\u4e49\u4ee3\u7801\u3002\u4f8b\u5982\uff0c\u5f53\u6587\u7ae0\u53d1\u5e03\u65f6\uff0c\u5f53\u7528\u6237\u767b\u5f55\u65f6\uff0c\u6216\u8005\u5f53\u540e\u53f0\u7ba1\u7406\u9875\u9762\u52a0\u8f7d\u65f6\u3002\u4f7f\u7528 <code>add_action()<\/code> \u51fd\u6570\u53ef\u4ee5\u5c06\u4f60\u7684\u51fd\u6570\u6302\u8f7d\u5230\u6307\u5b9a\u7684\u94a9\u5b50\u4e0a\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u9762\u7684\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u5728\u7f51\u7ad9\u524d\u53f0\u9875\u9762\u7684\u5e95\u90e8\u6dfb\u52a0\u4e00\u6bb5\u81ea\u5b9a\u4e49\u6587\u672c\u3002\u6211\u4eec\u4f7f\u7528 <code>wp_footer<\/code> \u8fd9\u4e2a\u52a8\u4f5c\u94a9\u5b50\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-php\">function myplugin_add_footer_text() {\n    echo &#039;&lt;p style=&quot;text-align:center;&quot;&gt;\u611f\u8c22\u4f7f\u7528\u672c\u7f51\u7ad9\uff01&lt;\/p&gt;&#039;;\n}\nadd_action( &#039;wp_footer&#039;, &#039;myplugin_add_footer_text&#039; );<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u8fc7\u6ee4\u5668\u7684\u8fd0\u7528<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fc7\u6ee4\u5668\uff08Filters\uff09\u7528\u4e8e\u4fee\u6539\u5728\u8fc7\u7a0b\u4e2d\u751f\u6210\u7684\u6570\u636e\u3002\u4e0e\u52a8\u4f5c\u4e0d\u540c\uff0c\u8fc7\u6ee4\u5668\u9700\u8981\u63a5\u6536\u4e00\u4e2a\u8f93\u5165\u503c\uff0c\u5e76\u5fc5\u987b\u8fd4\u56de\u4e00\u4e2a\u4fee\u6539\u540e\u7684\u503c\u3002\u4f7f\u7528 <code>add_filter()<\/code> \u51fd\u6570\u6765\u5e94\u7528\u8fc7\u6ee4\u5668\u3002<\/p>\n<!-- AUTO_SYNCED_PATTERN_INSERT_START -->\n\r\n<div class=\"flex justify-between items-center flex-col lg:flex-row xl:flex-col 2xl:flex-row gap-6 sm:gap-8 rounded-lg border border-gray-200 dark:border-gray-700 p-4 mb-8 lg:mb-10 sm:p-6 bg-white dark:bg-gray-750 shadow-md transition-colors duration-300\"\r\n     data-link=\"https:\/\/www.likacloud.com\/ja\/tolink\/hosting-shared-hosting\/\">\r\n     \r\n  <div class=\"flex flex-col gap-3 gap-4 sm:gap-6 w-full\">\r\n    <strong class=\"text-2xl font-semibold text-gray-900 dark:text-gray-200\">\r\n      hosting.com \u5171\u4eab\u4e3b\u673a    <\/strong>\r\n    <div class=\"text-gray-600 dark:text-gray-300 word-word\">\u9ad8\u6027\u80fd\uff0c\u914d\u5907 AMD EPYC CPU\u3001NVMe SSD \u5b58\u50a8\u548c LiteSpeed\uff0c\u5168\u5929\u501924\u5c0f\u65f6\u3001\u5168\u5929\u5019\u7684\u4e13\u5bb6\u5185\u90e8\u652f\u6301\uff0c\u9ad8\u7ea7\u5b89\u5168\u63aa\u65bd\uff0c\u5305\u62ec SSL\u3001\u66b4\u529b\u7834\u89e3\u3001\u6076\u610f\u8f6f\u4ef6\u548c DDoS \u9632\u62a4\uff0c\u8282\u7701\u9ad8\u8fbe 73%<\/div>\r\n  <\/div>\r\n\r\n  <div class=\"flex items-center flex-col md:flex-row lg:flex-col xl:flex-row 2xl:flex-col gap-6 shrink-0\">\r\n          <a href=\"https:\/\/www.likacloud.com\/ja\/tolink\/hosting-shared-hosting\/\">\r\n                  <img decoding=\"async\" src=\"https:\/\/www.likacloud.com\/wp-content\/uploads\/2025\/09\/20250901222940.svg\" alt=\"hosting.com LOGO\" class=\"content-promotion-card-icon h-9 min-h-9 dark:hidden\" title=\"\">\r\n          <img decoding=\"async\" src=\"https:\/\/www.likacloud.com\/wp-content\/uploads\/2025\/12\/20251228220957.webp\" alt=\"hosting.com LOGO\" class=\"content-promotion-card-icon h-9 min-h-9 hidden dark:block\" title=\"\">\r\n              <\/a>\r\n    \r\n    <a href=\"https:\/\/www.likacloud.com\/ja\/tolink\/hosting-shared-hosting\/\"\r\n       class=\"bg-blue-500 w-full md:w-auto lg:w-full xl:w-auto 2xl:w-full text-center !text-white dark:!text-gray-200 !px-5 !py-1.5 rounded-full hover:bg-blue-600 transition-colors\">\r\n       \u8bbf\u95ee\u9875\u9762    <\/a>\r\n  <\/div>\r\n<\/div>\n<!-- AUTO_SYNCED_PATTERN_INSERT_END -->\n\n\n\n\n\n<p class=\"wp-block-paragraph\">\u4f8b\u5982\uff0c\u4e0b\u9762\u7684\u4ee3\u7801\u4fee\u6539\u4e86\u6587\u7ae0\u6807\u9898\u672b\u5c3e\u7684\u663e\u793a\u5185\u5bb9\uff0c\u4e3a\u6240\u6709\u6807\u9898\u6dfb\u52a0\u4e00\u4e2a\u540e\u7f00\u3002\u6211\u4eec\u4f7f\u7528 <code>the_title<\/code> \u8fd9\u4e2a\u8fc7\u6ee4\u5668\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-php\">function myplugin_modify_title( $title ) {\n    \/\/ \u786e\u4fdd\u53ea\u5728\u4e3b\u5faa\u73af\u4e2d\u4fee\u6539\n    if ( is_single() ) {\n        return $title . &#039; [\u63a8\u8350\u9605\u8bfb]&#039;;\n    }\n    return $title;\n}\nadd_filter( &#039;the_title&#039;, &#039;myplugin_modify_title&#039; );<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e3a\u63d2\u4ef6\u6dfb\u52a0\u8bbe\u7f6e\u9875\u9762<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e00\u4e2a\u6210\u719f\u7684\u63d2\u4ef6\u901a\u5e38\u9700\u8981\u4e3a\u7528\u6237\u63d0\u4f9b\u914d\u7f6e\u9009\u9879\u3002\u5728 WordPress \u4e2d\uff0c\u4e3a\u63d2\u4ef6\u521b\u5efa\u8bbe\u7f6e\u9875\u9762\u6709\u6807\u51c6\u5316\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5c06\u5176\u6dfb\u52a0\u5230\u540e\u53f0\u83dc\u5355\u7684\u4e0d\u540c\u4f4d\u7f6e\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u521b\u5efa\u7ba1\u7406\u83dc\u5355\u9879<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u9996\u5148\uff0c\u4f60\u9700\u8981\u4f7f\u7528 <code>add_action( \u2018admin_menu\u2019, \u2026 )<\/code> \u94a9\u5b50\u6765\u6ce8\u518c\u4e00\u4e2a\u65b0\u7684\u83dc\u5355\u9875\u9762\u3002WordPress \u63d0\u4f9b\u4e86\u591a\u4e2a\u51fd\u6570\u6765\u6dfb\u52a0\u4e0d\u540c\u5c42\u7ea7\u7684\u83dc\u5355\uff0c\u5982 <code>add_menu_page()<\/code>\uff08\u9876\u7ea7\u83dc\u5355\uff09\u6216 <code>add_options_page()<\/code>\uff08\u6dfb\u52a0\u5230\u201c\u8bbe\u7f6e\u201d\u5b50\u83dc\u5355\u4e0b\uff09\u3002<\/p>\n<!-- AUTO_INTERNAL_LINKS_START --><p>\u63a8\u8350\u9605\u8bfb <a href=\"https:\/\/www.likacloud.com\/es\/knowledge\/wordpress\/wordpress-plugin-development-complete-guide-from-beginner-to-expert-12370915\/\">WordPress\u63d2\u4ef6\u5f00\u53d1\u5b8c\u5168\u6307\u5357\uff1a\u4ece\u5165\u95e8\u5230\u7cbe\u901a\u6253\u9020\u529f\u80fd\u63d2\u4ef6<\/a>\u3002<\/p><!-- AUTO_INTERNAL_LINKS_END -->\n\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u9762\u7684\u4ee3\u7801\u6f14\u793a\u4e86\u5982\u4f55\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684\u9876\u7ea7\u83dc\u5355\u9875\u9762\u3002\u51fd\u6570 <code>myplugin_settings_page_html<\/code> \u8d1f\u8d23\u6e32\u67d3\u8be5\u9875\u9762\u7684 HTML \u5185\u5bb9\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-php\">function myplugin_add_menu() {\n    add_menu_page(\n        \u2018\u6211\u7684\u63d2\u4ef6\u8bbe\u7f6e\u2019,          \/\/ \u9875\u9762\u6807\u9898\n        \u2018\u6211\u7684\u63d2\u4ef6\u2019,             \/\/ \u83dc\u5355\u6807\u9898\n        \u2018manage_options\u2019,      \/\/ \u6240\u9700\u6743\u9650\n        \u2018myplugin\u2019,            \/\/ \u83dc\u5355 Slug\n        \u2018myplugin_settings_page_html\u2019, \/\/ \u56de\u8c03\u51fd\u6570\n        \u2018dashicons-admin-generic\u2019, \/\/ \u56fe\u6807\uff08\u53ef\u9009\uff09\n        20                     \/\/ \u4f4d\u7f6e\uff08\u53ef\u9009\uff09\n    );\n}\nadd_action( \u2018admin_menu\u2019, \u2018myplugin_add_menu\u2019 );\n\nfunction myplugin_settings_page_html() {\n    \/\/ \u68c0\u67e5\u7528\u6237\u6743\u9650\n    if ( ! current_user_can( \u2018manage_options\u2019 ) ) {\n        return;\n    }\n    ?&gt;\n    &lt;div class=\u201cwrap\u201d&gt;\n        &lt;h1&gt;&lt;?php echo esc_html( get_admin_page_title() ); ?&gt;&lt;\/h1&gt;\n        &lt;form action=\u201coptions.php\u201d method=\u201cpost\u201d&gt;\n            &lt;?php\n            \/\/ \u8f93\u51fa\u8bbe\u7f6e\u5b57\u6bb5\n            settings_fields( \u2018myplugin_options\u2019 );\n            do_settings_sections( \u2018myplugin\u2019 );\n            submit_button( \u2018\u4fdd\u5b58\u8bbe\u7f6e\u2019 );\n            ?&gt;\n        &lt;\/form&gt;\n    &lt;\/div&gt;\n    &lt;?php\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u6ce8\u518c\u8bbe\u7f6e\u3001\u5b57\u6bb5\u4e0e\u533a\u6bb5<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e3a\u4e86\u4f7f\u4e0a\u8ff0\u8868\u5355\u80fd\u591f\u5b58\u50a8\u6570\u636e\uff0c\u4f60\u9700\u8981\u4f7f\u7528 WordPress \u8bbe\u7f6e API\u3002\u8fd9\u5305\u62ec\u7528 <code>register_setting()<\/code> \u6ce8\u518c\u4e00\u4e2a\u8bbe\u7f6e\u7ec4\uff0c\u7528 <code>add_settings_section()<\/code> \u6dfb\u52a0\u4e00\u4e2a\u533a\u6bb5\uff0c\u4ee5\u53ca\u7528 <code>add_settings_field()<\/code> \u6dfb\u52a0\u5177\u4f53\u7684\u5b57\u6bb5\u3002<\/p>\n<!-- AUTO_SYNCED_PATTERN_INSERT_START -->\n\r\n<div class=\"flex justify-between items-center flex-col lg:flex-row xl:flex-col 2xl:flex-row gap-6 sm:gap-8 rounded-lg border border-gray-200 dark:border-gray-700 p-4 mb-8 lg:mb-10 sm:p-6 bg-white dark:bg-gray-750 shadow-md transition-colors duration-300\"\r\n     data-link=\"https:\/\/www.likacloud.com\/ja\/tolink\/interserver-webhosting\/\">\r\n     \r\n  <div class=\"flex flex-col gap-3 gap-4 sm:gap-6 w-full\">\r\n    <strong class=\"text-2xl font-semibold text-gray-900 dark:text-gray-200\">\r\n      InterServer \u5171\u4eab\u4e3b\u673a    <\/strong>\r\n    <div class=\"text-gray-600 dark:text-gray-300 word-word\">\u5171\u4eab\u4e3b\u673a\u6bcf\u6708 $2.50 USD , \u9996\u6708 $0.1 USD \u4f18\u60e0\u7801 tryinterserver, 461\u4e2a\u4e91\u5e94\u7528\u811a\u672c\uff0c\u4e00\u952e\u5b89\u88c5\u3002<\/div>\r\n  <\/div>\r\n\r\n  <div class=\"flex items-center flex-col md:flex-row lg:flex-col xl:flex-row 2xl:flex-col gap-6 shrink-0\">\r\n          <a href=\"https:\/\/www.likacloud.com\/ja\/tolink\/interserver-webhosting\/\">\r\n                  <img decoding=\"async\" src=\"https:\/\/www.likacloud.com\/wp-content\/uploads\/2025\/12\/20251228045033.svg\" alt=\"InterServer LOGO\" class=\"content-promotion-card-icon h-9 min-h-9 dark:hidden\" title=\"\">\r\n          <img decoding=\"async\" src=\"https:\/\/www.likacloud.com\/wp-content\/uploads\/2025\/12\/20251229054830.webp\" alt=\"InterServer LOGO\" class=\"content-promotion-card-icon h-9 min-h-9 hidden dark:block\" title=\"\">\r\n              <\/a>\r\n    \r\n    <a href=\"https:\/\/www.likacloud.com\/ja\/tolink\/interserver-webhosting\/\"\r\n       class=\"bg-blue-500 w-full md:w-auto lg:w-full xl:w-auto 2xl:w-full text-center !text-white dark:!text-gray-200 !px-5 !py-1.5 rounded-full hover:bg-blue-600 transition-colors\">\r\n       \u8bbf\u95ee\u9875\u9762    <\/a>\r\n  <\/div>\r\n<\/div>\n<!-- AUTO_SYNCED_PATTERN_INSERT_END -->\n\n\n\n\n\n<p class=\"wp-block-paragraph\">\u6b64\u8fc7\u7a0b\u901a\u5e38\u5728 <code>admin_init<\/code> \u94a9\u5b50\u4e2d\u5b8c\u6210\u3002\u8bbe\u7f6e API \u4f1a\u81ea\u52a8\u5904\u7406\u6570\u636e\u9a8c\u8bc1\u3001\u5b58\u50a8\uff08\u5230 <code>wp_options<\/code> \u8868\uff09\u548c\u5b89\u5168\u6027\uff08Nonce \u68c0\u67e5\uff09\uff0c\u6781\u5927\u5730\u7b80\u5316\u4e86\u5f00\u53d1\u5de5\u4f5c\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u603b\u7ed3<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">WordPress \u63d2\u4ef6\u5f00\u53d1\u662f\u4e00\u4e2a\u7cfb\u7edf\u6027\u7684\u5de5\u7a0b\uff0c\u4ece\u642d\u5efa\u73af\u5883\u3001\u521b\u5efa\u57fa\u7840\u6587\u4ef6\uff0c\u5230\u6df1\u5165\u7406\u89e3\u5e76\u8fd0\u7528\u94a9\u5b50\u7cfb\u7edf\uff0c\u6700\u540e\u4e3a\u63d2\u4ef6\u6784\u5efa\u7528\u6237\u4ea4\u4e92\u754c\u9762\u3002\u9075\u5faa WordPress \u7f16\u7801\u6807\u51c6\u548c\u6700\u4f73\u5b9e\u8df5\uff08\u5982\u4f7f\u7528\u63d2\u4ef6\u5934\u6ce8\u91ca\u3001\u5b89\u5168\u7684\u51fd\u6570\u524d\u7f00\u3001\u56fd\u9645\u5316\u548c\u8bbe\u7f6e API\uff09\u4e0d\u4ec5\u80fd\u4fdd\u8bc1\u63d2\u4ef6\u7684\u7a33\u5b9a\u8fd0\u884c\uff0c\u8fd8\u80fd\u4f7f\u5176\u6613\u4e8e\u7ef4\u62a4\u548c\u6269\u5c55\u3002\u6838\u5fc3\u5728\u4e8e\u5229\u7528 WordPress \u63d0\u4f9b\u7684\u5e9e\u5927\u94a9\u5b50\u751f\u6001\u7cfb\u7edf\uff0c\u4ee5\u6a21\u5757\u5316\u3001\u975e\u4fb5\u5165\u5f0f\u7684\u65b9\u5f0f\u589e\u5f3a\u7f51\u7ad9\u529f\u80fd\u3002\u901a\u8fc7\u672c\u7bc7\u6307\u5357\u7684\u5b9e\u8df5\uff0c\u4f60\u5df2\u7ecf\u638c\u63e1\u4e86\u4ece\u96f6\u6784\u5efa\u4e00\u4e2a\u529f\u80fd\u5b8c\u6574\u3001\u7ed3\u6784\u6e05\u6670\u7684\u81ea\u5b9a\u4e49\u63d2\u4ef6\u7684\u57fa\u672c\u8def\u5f84\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">FAQ \u5e38\u89c1\u95ee\u9898<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u5f00\u53d1\u63d2\u4ef6\u9700\u8981\u54ea\u4e9b\u7f16\u7a0b\u57fa\u7840<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f60\u9700\u8981\u5177\u5907\u575a\u5b9e\u7684 PHP \u57fa\u7840\u77e5\u8bc6\uff0c\u56e0\u4e3a WordPress \u6838\u5fc3\u53ca\u5176\u63d2\u4ef6\u4e3b\u8981\u662f\u7528 PHP \u7f16\u5199\u7684\u3002\u540c\u65f6\uff0c\u5bf9 HTML\u3001CSS \u548c JavaScript\uff08\u7279\u522b\u662f jQuery\uff0c\u56e0\u4e3a WordPress \u5386\u53f2\u9057\u7559\u4ee3\u7801\u4e2d\u5927\u91cf\u4f7f\u7528\uff09\u6709\u57fa\u672c\u7684\u4e86\u89e3\u662f\u5fc5\u8981\u7684\uff0c\u8fd9\u5c06\u5e2e\u52a9\u4f60\u5904\u7406\u524d\u7aef\u663e\u793a\u548c\u4ea4\u4e92\u3002\u4e86\u89e3\u57fa\u672c\u7684 MySQL \u6570\u636e\u5e93\u64cd\u4f5c\u6982\u5ff5\u4e5f\u4f1a\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5982\u4f55\u907f\u514d\u63d2\u4ef6\u51fd\u6570\u540d\u4e0e\u5176\u5b83\u63d2\u4ef6\u51b2\u7a81<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u907f\u514d\u51b2\u7a81\u7684\u6700\u4f73\u5b9e\u8df5\u662f\u4f7f\u7528\u552f\u4e00\u7684\u524d\u7f00\u6765\u547d\u540d\u4f60\u7684\u6240\u6709\u51fd\u6570\u3001\u7c7b\u3001\u5e38\u91cf\u548c\u53d8\u91cf\u3002\u8fd9\u4e2a\u524d\u7f00\u5e94\u8db3\u591f\u72ec\u7279\uff0c\u901a\u5e38\u4e0e\u4f60\u7684\u63d2\u4ef6\u540d\u79f0\u6216\u7f29\u5199\u76f8\u5173\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u7684\u63d2\u4ef6\u53eb\u201cAwesome Widget\u201d\uff0c\u53ef\u4ee5\u4f7f\u7528\u7c7b\u4f3c <code>aw_<\/code>\u3001<code>awesome_widget_<\/code> \u6216 <code>AW_<\/code> \u4f5c\u4e3a\u524d\u7f00\u3002\u5c06\u4ee3\u7801\u5c01\u88c5\u5728\u7c7b\uff08Class\uff09\u4e2d\u4e5f\u662f\u73b0\u4ee3 WordPress \u63d2\u4ef6\u5f00\u53d1\u4e2d\u5e7f\u6cdb\u91c7\u7528\u7684\u3001\u66f4\u4f18\u96c5\u7684\u907f\u514d\u51b2\u7a81\u548c\u7ec4\u7ec7\u4ee3\u7801\u7684\u65b9\u5f0f\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u63d2\u4ef6\u5e94\u8be5\u5b58\u50a8\u5728\u54ea\u4e2a\u76ee\u5f55<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u63d2\u4ef6\u6587\u4ef6\u5e94\u5b58\u50a8\u5728 WordPress \u5b89\u88c5\u76ee\u5f55\u4e0b\u7684 <code>\/wp-content\/plugins\/<\/code> \u6587\u4ef6\u5939\u5185\u3002\u5bf9\u4e8e\u7b80\u5355\u7684\u5355\u6587\u4ef6\u63d2\u4ef6\uff0c\u53ef\u4ee5\u76f4\u63a5\u5c06\u4e3b PHP \u6587\u4ef6\u653e\u5728\u6b64\u76ee\u5f55\u4e0b\u3002\u5bf9\u4e8e\u66f4\u590d\u6742\u7684\u63d2\u4ef6\uff0c\u5f3a\u70c8\u5efa\u8bae\u521b\u5efa\u4e00\u4e2a\u4ee5\u63d2\u4ef6\u547d\u540d\u7684\u72ec\u7acb\u5b50\u76ee\u5f55\uff08\u4f8b\u5982 <code>\/wp-content\/plugins\/my-awesome-plugin\/<\/code>\uff09\uff0c\u7136\u540e\u5c06\u6240\u6709\u63d2\u4ef6\u6587\u4ef6\uff08PHP\u3001CSS\u3001JS\u3001\u56fe\u7247\u7b49\uff09\u90fd\u7ec4\u7ec7\u5728\u8fd9\u4e2a\u5b50\u76ee\u5f55\u4e2d\u3002\u8fd9\u4f7f\u6587\u4ef6\u7ba1\u7406\u53d8\u5f97\u6e05\u6670\u6709\u5e8f\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5982\u4f55\u4e3a\u63d2\u4ef6\u6dfb\u52a0\u7ffb\u8bd1\u652f\u6301<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e3a\u63d2\u4ef6\u6dfb\u52a0\u56fd\u9645\u5316\uff08i18n\uff09\u652f\u6301\u4e3b\u8981\u6d89\u53ca\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u9996\u5148\uff0c\u5728\u63d2\u4ef6\u5934\u6ce8\u91ca\u4e2d\u6b63\u786e\u8bbe\u7f6e <code>Text Domain<\/code>\uff0c\u5e76\u5728\u4ee3\u7801\u4e2d\u4f7f\u7528 WordPress \u7684\u7ffb\u8bd1\u51fd\u6570\uff0c\u5982 <code>()<\/code>\u3001<code>_e()<\/code>\u3001<code>esc_html()<\/code> \u7b49\u6765\u5305\u88f9\u6240\u6709\u9700\u8981\u7ffb\u8bd1\u7684\u5b57\u7b26\u4e32\u3002\u7136\u540e\uff0c\u4f7f\u7528\u5de5\u5177\u5982 Poedit \u6765\u63d0\u53d6\u8fd9\u4e9b\u5b57\u7b26\u4e32\uff0c\u751f\u6210 <code>.pot<\/code> \u6a21\u677f\u6587\u4ef6\uff0c\u5e76\u636e\u6b64\u521b\u5efa\u5bf9\u5e94\u8bed\u8a00\u7684 <code>.po<\/code> \u548c <code>.mo<\/code> \u7ffb\u8bd1\u6587\u4ef6\u3002\u6700\u540e\uff0c\u5728\u63d2\u4ef6\u521d\u59cb\u5316\u65f6\u4f7f\u7528 <code>load_plugin_textdomain()<\/code> \u51fd\u6570\u6765\u52a0\u8f7d\u7ffb\u8bd1\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001WordPress\u30d7\u30e9\u30b0\u30a4\u30f3\u958b\u767a\u306e\u57fa\u672c\u7684\u306a\u6d41\u308c\u306b\u3064\u3044\u3066\u4f53\u7cfb\u7684\u306b\u8aac\u660e\u3057\u3066\u3044\u307e\u3059\u3002\u307e\u305a\u3001\u30ed\u30fc\u30ab\u30eb\u958b\u767a\u74b0\u5883\u3068\u30c4\u30fc\u30eb\u306e\u8a2d\u5b9a\u65b9\u6cd5\u3092\u89e3\u8aac\u3057\u3001\u6b21\u306b\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u30e1\u30a4\u30f3\u30d5\u30a1\u30a4\u30eb\u306e\u4f5c\u6210\u3068\u6709\u52b9\u5316\u306e\u624b\u9806\u3092\u8a73\u3057\u304f\u8aac\u660e\u3057\u307e\u3059\u3002\u6700\u5f8c\u306b\u3001WordPress\u306e\u30b3\u30a2\u306b\u3042\u308b\u30d5\u30c3\u30af\uff08\u30a2\u30af\u30b7\u30e7\u30f3\u3068\u30d5\u30a3\u30eb\u30bf\u30fc\uff09\u306e\u4ed5\u7d44\u307f\u3092\u6df1\u304f\u5206\u6790\u3057\u3001\u30b3\u30fc\u30c9\u4f8b\u3092\u901a\u3058\u3066\u305d\u308c\u3089\u3092\u5229\u7528\u3057\u3066\u6a5f\u80fd\u3092\u62e1\u5f35\u3059\u308b\u65b9\u6cd5\u3092\u30c7\u30e2\u30f3\u30b9\u30c8\u30ec\u30fc\u30b7\u30e7\u30f3\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u958b\u767a\u8005\u304c\u30ab\u30b9\u30bf\u30e0\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306e\u5305\u62ec\u7684\u306a\u5165\u9580\u30ac\u30a4\u30c9\u3068\u306a\u308a\u307e\u3059\u3002<\/p>","protected":false},"author":7,"featured_media":0,"template":"","meta":{"_acf_changed":false,"footnotes":""},"tags":[20,366,1927,2025,2274],"knowledge_category":[280],"class_list":["post-12372074","knowledge_post","type-knowledge_post","status-publish","hentry","tag-wordpress-plugins","tag-development-guide","tag-plugin-development","tag-programming-tutorials","tag-custom-functions","knowledge_category-wordpress"],"acf":{"site_seo_keywords":"WordPress\u63d2\u4ef6\u5f00\u53d1,\u81ea\u5b9a\u4e49\u63d2\u4ef6\u6559\u7a0b,\u94a9\u5b50\u4e0e\u8fc7\u6ee4\u5668,\u672c\u5730\u73af\u5883\u914d\u7f6e,\u63d2\u4ef6\u4e3b\u6587\u4ef6,\u52a8\u4f5c\u94a9\u5b50,\u4ece\u96f6\u5f00\u59cb\u5f00\u53d1\u63d2\u4ef6,WordPress\u529f\u80fd\u6269\u5c55"},"_links":{"self":[{"href":"https:\/\/www.likacloud.com\/ja\/wp-json\/wp\/v2\/knowledge_posts\/12372074","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.likacloud.com\/ja\/wp-json\/wp\/v2\/knowledge_posts"}],"about":[{"href":"https:\/\/www.likacloud.com\/ja\/wp-json\/wp\/v2\/types\/knowledge_post"}],"author":[{"embeddable":true,"href":"https:\/\/www.likacloud.com\/ja\/wp-json\/wp\/v2\/users\/7"}],"version-history":[{"count":1,"href":"https:\/\/www.likacloud.com\/ja\/wp-json\/wp\/v2\/knowledge_posts\/12372074\/revisions"}],"predecessor-version":[{"id":12405809,"href":"https:\/\/www.likacloud.com\/ja\/wp-json\/wp\/v2\/knowledge_posts\/12372074\/revisions\/12405809"}],"wp:attachment":[{"href":"https:\/\/www.likacloud.com\/ja\/wp-json\/wp\/v2\/media?parent=12372074"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.likacloud.com\/ja\/wp-json\/wp\/v2\/tags?post=12372074"},{"taxonomy":"knowledge_category","embeddable":true,"href":"https:\/\/www.likacloud.com\/ja\/wp-json\/wp\/v2\/knowledge_category?post=12372074"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}