{"id":12365723,"date":"2026-03-13T13:45:59","date_gmt":"2026-03-13T05:45:59","guid":{"rendered":"https:\/\/www.likacloud.com\/knowledge\/wordpress%e6%8f%92%e4%bb%b6%e5%bc%80%e5%8f%91%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97%ef%bc%9a%e4%bb%8e%e9%9b%b6%e5%bc%80%e5%a7%8b%e5%88%9b%e5%bb%ba%e4%bd%a0%e7%9a%84%e7%ac%ac%e4%b8%80%e4%b8%aa%e6%8f%92\/"},"modified":"2026-06-03T20:12:00","modified_gmt":"2026-06-03T12:12:00","slug":"wordpress-plugin-development-beginner-guide-create-first-plugin-2026","status":"publish","type":"knowledge_post","link":"https:\/\/www.likacloud.com\/ru\/knowledge\/wordpress\/wordpress-plugin-development-beginner-guide-create-first-plugin-2026\/","title":{"rendered":"\u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432 \u0434\u043b\u044f WordPress: \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0441 \u043d\u0443\u043b\u044f"},"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\u4f60\u9700\u8981\u786e\u4fdd\u62e5\u6709\u4e00\u4e2a\u5408\u9002\u7684\u5f00\u53d1\u73af\u5883\u3002\u8fd9\u5305\u62ec\u4e00\u4e2a\u672c\u5730\u7684 WordPress \u5b89\u88c5\u548c\u4e00\u4e2a\u4ee3\u7801\u7f16\u8f91\u5668\u3002\u672c\u5730\u73af\u5883\u53ef\u4ee5\u8ba9\u4f60\u5728\u4e0d\u5f71\u54cd\u7ebf\u4e0a\u7f51\u7ad9\u7684\u60c5\u51b5\u4e0b\u81ea\u7531\u6d4b\u8bd5\u548c\u8c03\u8bd5\u3002\u5e38\u7528\u7684\u672c\u5730\u5f00\u53d1\u73af\u5883\u8f6f\u4ef6\u6709 Local by Flywheel\u3001XAMPP \u6216 MAMP\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f60\u9700\u8981\u4e3a\u4f60\u7684\u63d2\u4ef6\u60f3\u4e00\u4e2a\u552f\u4e00\u7684\u540d\u79f0\uff0c\u8fd9\u4e2a\u540d\u79f0\u5c06\u88ab\u7528\u4f5c\u63d2\u4ef6\u7684\u4e3b\u76ee\u5f55\u540d\u548c\u4e3b\u6587\u4ef6\u540d\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u7684\u63d2\u4ef6\u53eb\u505a\u201cHello World\u201d\uff0c\u90a3\u4e48\u4f60\u7684\u4e3b\u63d2\u4ef6\u6587\u4ef6\u53ef\u4ee5\u547d\u540d\u4e3a <code>hello-world.php<\/code>\u3002\u786e\u4fdd\u4f60\u7684\u63d2\u4ef6\u540d\u79f0\u548c\u63cf\u8ff0\u5728 WordPress \u63d2\u4ef6\u76ee\u5f55\u4e2d\u662f\u72ec\u4e00\u65e0\u4e8c\u7684\uff0c\u8fd9\u80fd\u6709\u6548\u907f\u514d\u4e0e\u5176\u4ed6\u63d2\u4ef6\u51b2\u7a81\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6b64\u5916\uff0c\u719f\u6089 WordPress \u7684\u5b98\u65b9\u5f00\u53d1\u624b\u518c\u548c\u4ee3\u7801\u53c2\u8003\u662f\u81f3\u5173\u91cd\u8981\u7684\u3002\u4e86\u89e3 WordPress \u7684\u6838\u5fc3\u6982\u5ff5\uff0c\u5982\u52a8\u4f5c\u94a9\u5b50\uff08Action Hooks\uff09\u3001\u8fc7\u6ee4\u5668\u94a9\u5b50\uff08Filter Hooks\uff09\u3001\u77ed\u4ee3\u7801\uff08Shortcodes\uff09\u548c\u8bbe\u7f6e API\uff0c\u5c06\u4e3a\u4f60\u7684\u5f00\u53d1\u5960\u5b9a\u575a\u5b9e\u57fa\u7840\u3002<\/p>\n<!-- AUTO_INTERNAL_LINKS_START --><p>\u63a8\u8350\u9605\u8bfb <a href=\"https:\/\/www.likacloud.com\/id\/knowledge\/wordpress\/wordpress-plugin-development-guide-from-scratch-to-professional-php-plugin\/\">WordPress\u63d2\u4ef6\u5f00\u53d1\u5168\u653b\u7565\uff1a\u4ece\u96f6\u5f00\u59cb\u6253\u9020\u4e13\u4e1a\u7684PHP\u63d2\u4ef6<\/a>\u3002<\/p><!-- AUTO_INTERNAL_LINKS_END -->\n\n\n\n\n<h2 class=\"wp-block-heading\">\u521b\u5efa\u7b2c\u4e00\u4e2a\u63d2\u4ef6\u6587\u4ef6<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u63d2\u4ef6\u7684\u6838\u5fc3\u662f\u4e00\u4e2a\u6216\u591a\u4e2a PHP \u6587\u4ef6\u3002\u6700\u7b80\u5355\u7684\u60c5\u51b5\u4e0b\uff0c\u4e00\u4e2a\u63d2\u4ef6\u53ef\u4ee5\u53ea\u7531\u4e00\u4e2a PHP \u6587\u4ef6\u6784\u6210\u3002\u4e3a\u4e86\u521b\u5efa\u4e00\u4e2a\u6709\u6548\u7684\u63d2\u4ef6\uff0c\u4f60\u9700\u8981\u5728\u4e3b\u63d2\u4ef6\u6587\u4ef6\u7684\u5934\u90e8\u6dfb\u52a0\u6807\u51c6\u7684\u63d2\u4ef6\u4fe1\u606f\u6ce8\u91ca\u3002\u8fd9\u4e2a\u6ce8\u91ca\u5757\u4f1a\u544a\u8bc9 WordPress \u5173\u4e8e\u4f60\u7684\u63d2\u4ef6\u7684\u6240\u6709\u5143\u4fe1\u606f\uff0c\u5982\u540d\u79f0\u3001\u63cf\u8ff0\u3001\u7248\u672c\u3001\u4f5c\u8005\u7b49\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\/ru\/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\/ru\/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\/ru\/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\">\u7f16\u5199\u63d2\u4ef6\u5934\u90e8\u4fe1\u606f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">WordPress \u901a\u8fc7\u8bfb\u53d6\u6587\u4ef6\u9876\u90e8\u7684\u7279\u5b9a\u683c\u5f0f\u7684\u6ce8\u91ca\u6765\u8bc6\u522b\u548c\u663e\u793a\u63d2\u4ef6\u4fe1\u606f\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u6700\u57fa\u672c\u7684\u63d2\u4ef6\u5934\u90e8\u793a\u4f8b\uff1a<\/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\u63d2\u4ef6\n * Plugin URI:        https:\/\/example.com\/my-first-plugin\n * Description:       \u8fd9\u662f\u4e00\u4e2a\u7528\u4e8e\u5b66\u4e60\u548c\u6f14\u793a\u7684\u7b80\u5355 WordPress \u63d2\u4ef6\u3002\n * Version:           1.0.0\n * Requires at least: 5.2\n * Requires PHP:      7.2\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 * Domain Path:       \/languages\n *\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5c06\u8fd9\u6bb5\u4ee3\u7801\u4fdd\u5b58\u4e3a\u4e00\u4e2a\u65b0\u7684 PHP \u6587\u4ef6\uff0c\u4f8b\u5982 <code>my-first-plugin.php<\/code>\u3002\u7136\u540e\uff0c\u5c06\u8fd9\u4e2a\u6587\u4ef6\u653e\u5165\u4f60\u672c\u5730 WordPress \u5b89\u88c5\u76ee\u5f55\u7684 <code>wp-content\/plugins<\/code> \u6587\u4ef6\u5939\u4e2d\u3002\u6b64\u65f6\uff0c\u8fdb\u5165 WordPress \u540e\u53f0\u7684\u201c\u63d2\u4ef6\u201d\u9875\u9762\uff0c\u4f60\u5e94\u8be5\u80fd\u770b\u5230\u4e00\u4e2a\u540d\u4e3a\u201c\u6211\u7684\u7b2c\u4e00\u4e2a\u63d2\u4ef6\u201d\u7684\u65b0\u63d2\u4ef6\u51fa\u73b0\u5728\u5217\u8868\u4e2d\uff0c\u5e76\u53ef\u4ee5\u6fc0\u6d3b\u5b83\u3002\u76ee\u524d\u5b83\u8fd8\u6ca1\u6709\u4efb\u4f55\u529f\u80fd\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u4e3a\u63d2\u4ef6\u6dfb\u52a0\u57fa\u7840\u529f\u80fd<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u6fc0\u6d3b\u63d2\u4ef6\u540e\uff0c\u6211\u4eec\u5c06\u4e3a\u5176\u6dfb\u52a0\u4e00\u4e2a\u7b80\u5355\u7684\u529f\u80fd\uff1a\u5728\u6587\u7ae0\u5185\u5bb9\u7684\u672b\u5c3e\u81ea\u52a8\u6dfb\u52a0\u4e00\u6bb5\u81ea\u5b9a\u4e49\u6587\u672c\u3002\u8fd9\u9700\u8981\u7528\u5230 WordPress \u7684\u8fc7\u6ee4\u5668\u94a9\u5b50 <code>the_content<\/code>\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f60\u53ef\u4ee5\u5c06\u4ee5\u4e0b\u4ee3\u7801\u6dfb\u52a0\u5230\u521a\u624d\u7684\u63d2\u4ef6\u5934\u90e8\u4fe1\u606f\u4e0b\u65b9\uff1a<\/p>\n<!-- AUTO_INTERNAL_LINKS_START --><p>\u63a8\u8350\u9605\u8bfb <a href=\"https:\/\/www.likacloud.com\/id\/knowledge\/wordpress\/wordpress-plugin-development-tutorial-from-scratch-e7-9f-a5-e8-af-86\/\">\u4ece\u96f6\u5f00\u59cb\uff1aWordPress\u63d2\u4ef6\u5f00\u53d1\u5168\u6d41\u7a0b\u8be6\u89e3<\/a>\u3002<\/p><!-- AUTO_INTERNAL_LINKS_END -->\n\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-php\">\/**\n * \u5728\u6587\u7ae0\u5185\u5bb9\u672b\u5c3e\u6dfb\u52a0\u81ea\u5b9a\u4e49\u6587\u672c\n *\n * @param string $content \u5f53\u524d\u6587\u7ae0\u5185\u5bb9\u3002\n * @return string \u4fee\u6539\u540e\u7684\u6587\u7ae0\u5185\u5bb9\u3002\n *\/\nfunction mfp_add_footer_text( $content ) {\n    \/\/ \u4ec5\u9488\u5bf9\u4e3b\u5faa\u73af\u4e2d\u7684\u5355\u4e2a\u6587\u7ae0\u9875\u9762\n    if ( is_single() &amp;&amp; in_the_loop() &amp;&amp; is_main_query() ) {\n        $custom_text = &#039;&lt;p&gt;&lt;em&gt;\u611f\u8c22\u60a8\u9605\u8bfb\u8fd9\u7bc7\u6587\u7ae0\uff0c\u7531\u201c\u6211\u7684\u7b2c\u4e00\u4e2a\u63d2\u4ef6\u201d\u5448\u73b0\u3002&lt;\/em&gt;&lt;\/p&gt;&#039;;\n        $content .= $custom_text;\n    }\n    return $content;\n}\n\/\/ \u5c06\u81ea\u5b9a\u4e49\u51fd\u6570\u6302\u8f7d\u5230 `the_content` \u8fc7\u6ee4\u5668\u4e0a\nadd_filter( &#039;the_content&#039;, &#039;mfp_add_footer_text&#039; );<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u6bb5\u4ee3\u7801\u5b9a\u4e49\u4e86\u4e00\u4e2a\u540d\u4e3a <code>mfp_add_footer_text<\/code> \u7684\u51fd\u6570\uff0c\u5b83\u63a5\u6536\u6587\u7ae0\u5185\u5bb9 <code>$content<\/code> \u4f5c\u4e3a\u53c2\u6570\u3002\u51fd\u6570\u5185\u90e8\u9996\u5148\u4f7f\u7528\u6761\u4ef6\u6807\u7b7e\uff08<code>is_single()<\/code>, <code>in_the_loop()<\/code>, <code>is_main_query()<\/code>\uff09\u6765\u786e\u4fdd\u6211\u4eec\u53ea\u5728\u5355\u4e2a\u6587\u7ae0\u9875\u9762\u7684\u4e3b\u5faa\u73af\u4e2d\u4fee\u6539\u5185\u5bb9\uff0c\u907f\u514d\u5f71\u54cd\u5176\u4ed6\u9875\u9762\u5982\u9996\u9875\u3001\u5b58\u6863\u9875\u3002\u7136\u540e\uff0c\u5b83\u521b\u5efa\u4e00\u6bb5\u81ea\u5b9a\u4e49\u7684 HTML \u6587\u672c\uff0c\u5e76\u5c06\u5176\u9644\u52a0\u5230\u539f\u6587\u5185\u5bb9\u4e4b\u540e\u3002\u6700\u540e\uff0c\u901a\u8fc7 <code>add_filter<\/code> \u51fd\u6570\u5c06\u8fd9\u4e2a\u81ea\u5b9a\u4e49\u51fd\u6570\u201c\u6302\u8f7d\u201d\u5230 WordPress \u7684 <code>the_content<\/code> \u8fc7\u6ee4\u5668\u4e0a\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4fdd\u5b58\u6587\u4ef6\u540e\uff0c\u5237\u65b0\u524d\u7aef\u7684\u4e00\u7bc7\u6587\u7ae0\u9875\u9762\uff0c\u4f60\u5c06\u5728\u6587\u7ae0\u6b63\u6587\u7684\u672b\u5c3e\u770b\u5230\u6dfb\u52a0\u7684\u6587\u672c\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5f00\u53d1\u8fdb\u9636\u529f\u80fd\uff1a\u521b\u5efa\u7ba1\u7406\u83dc\u5355\u4e0e\u9009\u9879\u9875<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e00\u4e2a\u529f\u80fd\u5b8c\u5584\u7684\u63d2\u4ef6\u901a\u5e38\u9700\u8981\u4e0e\u7ba1\u7406\u5458\u4ea4\u4e92\uff0c\u8fd9\u901a\u5e38\u901a\u8fc7\u5728\u540e\u7aef\u6dfb\u52a0\u8bbe\u7f6e\u9875\u9762\u6765\u5b9e\u73b0\u3002WordPress \u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684 API \u6765\u521b\u5efa\u7ba1\u7406\u83dc\u5355\u548c\u9009\u9879\u9875\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\/ru\/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\/ru\/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\/ru\/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<h3 class=\"wp-block-heading\">\u5728\u540e\u53f0\u6dfb\u52a0\u63d2\u4ef6\u83dc\u5355\u9879<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u5c06\u4e3a\u63d2\u4ef6\u521b\u5efa\u4e00\u4e2a\u72ec\u7acb\u7684\u7ba1\u7406\u83dc\u5355\u9875\u9762\uff0c\u7528\u4e8e\u914d\u7f6e\u4e00\u4e9b\u9009\u9879\u3002\u8fd9\u9700\u8981\u4f7f\u7528 <code>add_action<\/code> \u94a9\u5b50\u548c <code>admin_menu<\/code> \u52a8\u4f5c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u4f60\u7684\u63d2\u4ef6\u4e3b\u6587\u4ef6\u4e2d\u7ee7\u7eed\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-php\">\/**\n * \u5728 WordPress \u540e\u53f0\u7ba1\u7406\u83dc\u5355\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u65b0\u7684\u9876\u7ea7\u83dc\u5355\u9879\n *\/\nfunction mfp_register_admin_menu() {\n    add_menu_page(\n        &#039;\u6211\u7684\u63d2\u4ef6\u8bbe\u7f6e&#039;,          \/\/ \u9875\u9762\u6807\u9898\n        &#039;\u6211\u7684\u63d2\u4ef6&#039;,             \/\/ \u83dc\u5355\u6807\u9898\n        &#039;manage_options&#039;,       \/\/ \u6240\u9700\u6743\u9650\n        &#039;my-first-plugin&#039;,      \/\/ \u83dc\u5355 slug\n        &#039;mfp_render_settings_page&#039;, \/\/ \u6e32\u67d3\u9875\u9762\u7684\u56de\u8c03\u51fd\u6570\n        &#039;dashicons-admin-plugins&#039;, \/\/ \u56fe\u6807\uff08\u53ef\u9009\uff09\n        80                      \/\/ \u83dc\u5355\u4f4d\u7f6e\n    );\n}\nadd_action( &#039;admin_menu&#039;, &#039;mfp_register_admin_menu&#039; );<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>add_menu_page<\/code> \u51fd\u6570\u7528\u4e8e\u6ce8\u518c\u4e00\u4e2a\u65b0\u7684\u9876\u7ea7\u83dc\u5355\u3002\u5176\u4e2d\uff0c<code>manage_options<\/code> \u662f\u4e00\u4e2a\u6743\u9650\u6807\u8bc6\uff0c\u610f\u5473\u7740\u53ea\u6709\u5177\u6709\u201c\u7ba1\u7406\u9009\u9879\u201d\u6743\u9650\u7684\u7528\u6237\uff08\u901a\u5e38\u662f\u7ba1\u7406\u5458\uff09\u624d\u80fd\u770b\u5230\u8fd9\u4e2a\u83dc\u5355\u3002<code>mfp_render_settings_page<\/code> \u662f\u6211\u4eec\u63a5\u4e0b\u6765\u8981\u5b9a\u4e49\u7684\u3001\u7528\u4e8e\u8f93\u51fa\u8bbe\u7f6e\u9875\u9762 HTML \u5185\u5bb9\u7684\u51fd\u6570\u540d\u3002<\/p>\n<!-- AUTO_INTERNAL_LINKS_START --><p>\u63a8\u8350\u9605\u8bfb <a href=\"https:\/\/www.likacloud.com\/id\/knowledge\/wordpress\/wordpress-plugin-development-guide-build-custom-plugin\/\">WordPress \u63d2\u4ef6\u5f00\u53d1\u7ec8\u6781\u6307\u5357\uff1a\u4ece\u96f6\u6784\u5efa\u4f60\u7684\u7b2c\u4e00\u4e2a\u81ea\u5b9a\u4e49\u63d2\u4ef6<\/a>\u3002<\/p><!-- AUTO_INTERNAL_LINKS_END -->\n\n\n\n\n<h3 class=\"wp-block-heading\">\u6784\u5efa\u8bbe\u7f6e\u9875\u9762\u7684\u5185\u5bb9<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u73b0\u5728\uff0c\u6211\u4eec\u9700\u8981\u5b9a\u4e49\u4e0a\u9762\u63d0\u5230\u7684\u56de\u8c03\u51fd\u6570 <code>mfp_render_settings_page<\/code> \u6765\u6e32\u67d3\u4e00\u4e2a\u7b80\u5355\u7684\u8bbe\u7f6e\u9875\u9762\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-php\">\/**\n * \u6e32\u67d3\u63d2\u4ef6\u8bbe\u7f6e\u9875\u9762\u7684\u5185\u5bb9\n *\/\nfunction mfp_render_settings_page() {\n    ?&gt;\n    &lt;div class=&quot;wrap&quot;&gt;\n        &lt;h1&gt;&lt;?php echo esc_html( get_admin_page_title() ); ?&gt;&lt;\/h1&gt;\n        &lt;form action=&quot;options.php&quot; method=&quot;post&quot;&gt;\n            &lt;?php\n            \/\/ \u8f93\u51fa\u8bbe\u7f6e\u5b57\u6bb5\u3001\u5b89\u5168 nonce \u5b57\u6bb5\u7b49\n            settings_fields( &#039;mfp_settings_group&#039; );\n            do_settings_sections( &#039;my-first-plugin&#039; );\n            submit_button( &#039;\u4fdd\u5b58\u8bbe\u7f6e&#039; );\n            ?&gt;\n        &lt;\/form&gt;\n    &lt;\/div&gt;\n    &lt;?php\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u4e2a\u51fd\u6570\u8f93\u51fa\u4e86\u4e00\u4e2a\u57fa\u672c\u7684 WordPress \u7ba1\u7406\u9875\u9762\u7ed3\u6784\uff0c\u5305\u542b\u6807\u9898\u548c\u4e00\u4e2a\u8868\u5355\u3002\u5b83\u4f7f\u7528\u4e86 WordPress \u8bbe\u7f6e API \u7684\u4e24\u4e2a\u6838\u5fc3\u51fd\u6570\uff1a<code>settings_fields<\/code> \u548c <code>do_settings_sections<\/code>\u3002\u4e3a\u4e86\u4f7f\u5176\u5de5\u4f5c\uff0c\u6211\u4eec\u8fd8\u9700\u8981\u6ce8\u518c\u8bbe\u7f6e\u3001\u8282\u548c\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\/ru\/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\/ru\/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\/ru\/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<h3 class=\"wp-block-heading\">\u4f7f\u7528\u8bbe\u7f6e API \u6ce8\u518c\u9009\u9879<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">WordPress \u8bbe\u7f6e API \u63d0\u4f9b\u4e86\u4e00\u79cd\u5b89\u5168\u3001\u6807\u51c6\u5316\u7684\u65b9\u5f0f\u6765\u5904\u7406\u8868\u5355\u9009\u9879\u7684\u6ce8\u518c\u3001\u4fdd\u5b58\u548c\u9a8c\u8bc1\u3002\u6211\u4eec\u7ee7\u7eed\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\u6765\u6ce8\u518c\u4e00\u4e2a\u7b80\u5355\u7684\u6587\u672c\u5b57\u6bb5\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-php\">\/**\n * \u521d\u59cb\u5316\u63d2\u4ef6\u7684\u8bbe\u7f6e\n *\/\nfunction mfp_settings_init() {\n    \/\/ \u6ce8\u518c\u4e00\u4e2a\u65b0\u7684\u8bbe\u7f6e\u9879 `mfp_options` \u5230\u6570\u636e\u5e93\n    register_setting( &#039;mfp_settings_group&#039;, &#039;mfp_options&#039; );\n\n\/\/ \u5728\u9875\u9762\u5185\u6dfb\u52a0\u4e00\u4e2a\u65b0\u7684\u8282\n    add_settings_section(\n        &#039;mfp_section_basic&#039;,\n        &#039;\u57fa\u7840\u8bbe\u7f6e&#039;,\n        &#039;mfp_section_basic_callback&#039;,\n        &#039;my-first-plugin&#039;\n    );\n\n\/\/ \u5411\u8282\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u5b57\u6bb5\n    add_settings_field(\n        &#039;mfp_field_custom_text&#039;,\n        &#039;\u81ea\u5b9a\u4e49\u9875\u811a\u6587\u672c&#039;,\n        &#039;mfp_field_custom_text_callback&#039;,\n        &#039;my-first-plugin&#039;,\n        &#039;mfp_section_basic&#039;,\n        array( &#039;label_for&#039; =&gt; &#039;mfp_field_custom_text&#039; )\n    );\n}\nadd_action( &#039;admin_init&#039;, &#039;mfp_settings_init&#039; );\n\n\/**\n * \u8282\u63cf\u8ff0\u7684\u56de\u8c03\u51fd\u6570\uff08\u53ef\u4ee5\u4e3a\u7a7a\uff09\n *\/\nfunction mfp_section_basic_callback() {\n    echo &#039;&lt;p&gt;\u5728\u8fd9\u91cc\u914d\u7f6e\u63d2\u4ef6\u7684\u57fa\u7840\u9009\u9879\u3002&lt;\/p&gt;&#039;;\n}\n\n\/**\n * \u5b57\u6bb5 `mfp_field_custom_text` \u7684\u56de\u8c03\u51fd\u6570\uff0c\u7528\u4e8e\u8f93\u51fa HTML \u8f93\u5165\u6846\n *\/\nfunction mfp_field_custom_text_callback() {\n    \/\/ \u4ece\u6570\u636e\u5e93\u83b7\u53d6\u73b0\u6709\u503c\n    $options = get_option( &#039;mfp_options&#039; );\n    $value = isset( $options[&#039;custom_text&#039;] ) ? $options[&#039;custom_text&#039;] : &#039;&#039;;\n    ?&gt;\n    &lt;input type=&quot;text&quot;\n           id=&quot;mfp_field_custom_text&quot;\n           name=&quot;mfp_options[custom_text]&quot;\n           value=&quot;&lt;?php echo esc_attr( $value ); ?&gt;&quot;\n           class=&quot;regular-text&quot; \/&gt;\n    &lt;p class=&quot;description&quot;&gt;\u8fd9\u6bb5\u6587\u5b57\u5c06\u663e\u793a\u5728\u6587\u7ae0\u672b\u5c3e\u3002&lt;\/p&gt;\n    &lt;?php\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u73b0\u5728\uff0c\u6211\u4eec\u9700\u8981\u4fee\u6539\u4e4b\u524d\u7684 <code>mfp_add_footer_text<\/code> \u51fd\u6570\uff0c\u8ba9\u5b83\u4f7f\u7528\u6211\u4eec\u65b0\u521b\u5efa\u7684\u9009\u9879\u503c\uff0c\u800c\u4e0d\u662f\u786c\u7f16\u7801\u7684\u6587\u672c\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-php\">function mfp_add_footer_text( $content ) {\n    if ( is_single() &amp;&amp; in_the_loop() &amp;&amp; is_main_query() ) {\n        $options = get_option( &#039;mfp_options&#039; );\n        $custom_text = isset( $options[&#039;custom_text&#039;] ) ? $options[&#039;custom_text&#039;] : &#039;&#039;;\n        if ( ! empty( $custom_text ) ) {\n            $content .= &#039;&lt;p&gt;&lt;em&gt;&#039; . esc_html( $custom_text ) . &#039;&lt;\/em&gt;&lt;\/p&gt;&#039;;\n        }\n    }\n    return $content;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u81f3\u6b64\uff0c\u4f60\u7684\u63d2\u4ef6\u62e5\u6709\u4e86\u4e00\u4e2a\u5b8c\u6574\u7684\u540e\u53f0\u8bbe\u7f6e\u9875\u9762\u3002\u7ba1\u7406\u5458\u53ef\u4ee5\u5728\u201c\u6211\u7684\u63d2\u4ef6\u201d\u83dc\u5355\u4e0b\u627e\u5230\u8bbe\u7f6e\u9875\uff0c\u8f93\u5165\u81ea\u5b9a\u4e49\u7684\u9875\u811a\u6587\u672c\uff0c\u5e76\u4fdd\u5b58\u3002\u8fd9\u4e2a\u6587\u672c\u5c06\u52a8\u6001\u5730\u663e\u793a\u5728\u7f51\u7ad9\u524d\u7aef\u7684\u6587\u7ae0\u672b\u5c3e\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u63d2\u4ef6\u4f18\u5316\u4e0e\u5b89\u5168\u5b9e\u8df5<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f00\u53d1\u63d2\u4ef6\u65f6\uff0c\u9075\u5faa\u6700\u4f73\u5b9e\u8df5\u5bf9\u4e8e\u5b89\u5168\u6027\u3001\u6027\u80fd\u548c\u7ef4\u62a4\u6027\u81f3\u5173\u91cd\u8981\u3002\u8fd9\u91cc\u4ecb\u7ecd\u51e0\u4e2a\u6838\u5fc3\u539f\u5219\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u786e\u4fdd\u4ee3\u7801\u5b89\u5168<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u6240\u6709\u4ece\u524d\u7aef\u6216\u7ba1\u7406\u754c\u9762\u63a5\u6536\u5230\u7684\u6570\u636e\uff0c\u5728\u8f93\u51fa\u5230\u6d4f\u89c8\u5668\u6216\u5b58\u5165\u6570\u636e\u5e93\u4e4b\u524d\uff0c\u90fd\u5fc5\u987b\u8fdb\u884c\u9a8c\u8bc1\u3001\u6e05\u7406\u548c\u8f6c\u4e49\u3002\u8fd9\u53ef\u4ee5\u9632\u6b62\u8de8\u7ad9\u811a\u672c\uff08XSS\uff09\u548c SQL \u6ce8\u5165\u7b49\u5b89\u5168\u6f0f\u6d1e\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u8f6c\u4e49\u8f93\u51fa\uff1a\u4f7f\u7528\u51fd\u6570\u5982 <code>esc_html()<\/code>, <code>esc_attr()<\/code>, <code>esc_url()<\/code>, <code>wp_kses_post()<\/code> \u6765\u8f6c\u4e49\u52a8\u6001\u5185\u5bb9\u3002<\/li><li>\u6e05\u7406\u8f93\u5165\uff1a\u4f7f\u7528\u51fd\u6570\u5982 <code>sanitize_text_field()<\/code>, <code>sanitize_email()<\/code>, <code>intval()<\/code> \u6765\u5904\u7406\u7528\u6237\u63d0\u4ea4\u7684\u8868\u5355\u6570\u636e\u3002<\/li><li>\u6743\u9650\u68c0\u67e5\uff1a\u5728\u7ba1\u7406\u5458\u56de\u8c03\u51fd\u6570\u4e2d\uff0c\u4f7f\u7528 <code>current_user_can()<\/code> \u8fdb\u884c\u4e8c\u6b21\u6743\u9650\u786e\u8ba4\u3002\u5728\u6d89\u53ca\u6570\u636e\u4fee\u6539\u7684 AJAX \u6216 REST API \u7aef\u70b9\uff0c\u52a1\u5fc5\u4f7f\u7528 nonce\uff08\u6570\u5b57\u4ee4\u724c\uff09\u8fdb\u884c\u9a8c\u8bc1\u3002<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">\u9075\u5faa WordPress \u7f16\u7801\u6807\u51c6<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u91c7\u7528 WordPress \u7f16\u7801\u6807\u51c6\u53ef\u4ee5\u786e\u4fdd\u4f60\u7684\u4ee3\u7801\u98ce\u683c\u4e0e\u6838\u5fc3\u4ee3\u7801\u4e00\u81f4\uff0c\u63d0\u9ad8\u53ef\u8bfb\u6027\uff0c\u5e76\u65b9\u4fbf\u5176\u4ed6\u5f00\u53d1\u8005\u534f\u4f5c\u3002\u8fd9\u5305\u62ec\u4f7f\u7528\u6b63\u786e\u7684\u7f29\u8fdb\u3001\u62ec\u53f7\u98ce\u683c\u3001\u547d\u540d\u7ea6\u5b9a\uff08\u51fd\u6570\u548c\u53d8\u91cf\u4f7f\u7528\u5c0f\u5199\u5b57\u6bcd\u52a0\u4e0b\u5212\u7ebf\uff09\u7b49\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528 PHP CodeSniffer \u914d\u5408 WordPress \u6807\u51c6\u89c4\u5219\u6765\u81ea\u52a8\u68c0\u67e5\u4ee3\u7801\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b9e\u73b0\u56fd\u9645\u5316\u652f\u6301<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ece\u4e00\u5f00\u59cb\u5c31\u4e3a\u4f60\u7684\u63d2\u4ef6\u6dfb\u52a0\u56fd\u9645\u5316\u652f\u6301\uff0c\u53ef\u4ee5\u8ba9\u5168\u4e16\u754c\u7684\u7528\u6237\u8f7b\u677e\u5730\u5c06\u5176\u7ffb\u8bd1\u6210\u81ea\u5df1\u7684\u8bed\u8a00\u3002\u8fd9\u4e3b\u8981\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5b9e\u73b0\uff1a<br \/>\n1.  \u5728\u63d2\u4ef6\u5934\u90e8\u6ce8\u91ca\u4e2d\u6b63\u786e\u8bbe\u7f6e <code>Text Domain<\/code> \u548c <code>Domain Path<\/code>\u3002<br \/>\n2.  \u5728\u6240\u6709\u9700\u8981\u7ffb\u8bd1\u7684\u5b57\u7b26\u4e32\u5468\u56f4\u4f7f\u7528 WordPress \u7684\u7ffb\u8bd1\u51fd\u6570\uff0c\u5982 <code>()<\/code>, <code>_e()<\/code>, <code>esc_html()<\/code> \u7b49\u3002<br \/>\n3.  \u4f7f\u7528\u5de5\u5177\u5982 Poedit \u6765\u751f\u6210 <code>.pot<\/code> \u6a21\u677f\u6587\u4ef6\uff0c\u4f9b\u7ffb\u8bd1\u8005\u521b\u5efa <code>.po<\/code> \u548c <code>.mo<\/code> \u7ffb\u8bd1\u6587\u4ef6\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f8b\u5982\uff0c\u5c06\u8bbe\u7f6e\u9875\u7684\u63cf\u8ff0\u6587\u5b57\u56fd\u9645\u5316\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-php\">function mfp_section_basic_callback() {\n    echo &#039;&lt;p&gt;&#039; . esc_html__( &#039;\u5728\u8fd9\u91cc\u914d\u7f6e\u63d2\u4ef6\u7684\u57fa\u7840\u9009\u9879\u3002&#039;, &#039;my-first-plugin&#039; ) . &#039;&lt;\/p&gt;&#039;;\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u603b\u7ed3<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u672c\u6587\u4ece\u96f6\u5f00\u59cb\uff0c\u5f15\u5bfc\u4f60\u5b8c\u6210\u4e86\u521b\u5efa\u4e00\u4e2a\u57fa\u7840\u4f46\u529f\u80fd\u5b8c\u6574\u7684 WordPress \u63d2\u4ef6\u7684\u5168\u8fc7\u7a0b\u3002\u6211\u4eec\u6db5\u76d6\u4e86\u4ece\u73af\u5883\u51c6\u5907\u3001\u521b\u5efa\u63d2\u4ef6\u6587\u4ef6\u3001\u7f16\u5199\u63d2\u4ef6\u5934\u90e8\u4fe1\u606f\uff0c\u5230\u4f7f\u7528\u52a8\u4f5c\u94a9\u5b50\u548c\u8fc7\u6ee4\u5668\u94a9\u5b50\u4e3a\u6587\u7ae0\u6dfb\u52a0\u5185\u5bb9\uff0c\u518d\u5230\u4f7f\u7528 WordPress \u8bbe\u7f6e API \u6784\u5efa\u590d\u6742\u7684\u540e\u53f0\u7ba1\u7406\u754c\u9762\u3002\u6700\u540e\uff0c\u6211\u4eec\u63a2\u8ba8\u4e86\u63d2\u4ef6\u5f00\u53d1\u4e2d\u81f3\u5173\u91cd\u8981\u7684\u5b89\u5168\u3001\u7f16\u7801\u6807\u51c6\u548c\u56fd\u9645\u5316\u7b49\u4f18\u5316\u5b9e\u8df5\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u901a\u8fc7\u8fd9\u4e2a\u5b9e\u8df5\uff0c\u4f60\u5e94\u8be5\u5df2\u7ecf\u638c\u63e1\u4e86 WordPress \u63d2\u4ef6\u5f00\u53d1\u7684\u6838\u5fc3\u6d41\u7a0b\u548c\u57fa\u672c\u5de5\u5177\u3002\u4e0b\u4e00\u6b65\uff0c\u4f60\u53ef\u4ee5\u5c1d\u8bd5\u5f00\u53d1\u66f4\u590d\u6742\u7684\u529f\u80fd\uff0c\u5982\u521b\u5efa\u81ea\u5b9a\u4e49\u6587\u7ae0\u7c7b\u578b\u3001\u81ea\u5b9a\u4e49\u6570\u636e\u5e93\u8868\u3001\u4f7f\u7528 jQuery \u589e\u5f3a\u4ea4\u4e92\uff0c\u6216\u8005\u5c06\u4f60\u7684\u63d2\u4ef6\u63d0\u4ea4\u5230 WordPress \u5b98\u65b9\u63d2\u4ef6\u76ee\u5f55\u3002\u8bb0\u4f4f\uff0c\u6301\u7eed\u5b66\u4e60\u548c\u9605\u8bfb\u6838\u5fc3\u4ee3\u7801\u662f\u63d0\u5347\u5f00\u53d1\u6280\u80fd\u7684\u6700\u4f73\u9014\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\">\u5982\u4f55\u8c03\u8bd5\u6211\u7684 WordPress \u63d2\u4ef6\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u542f\u7528 WordPress \u7684\u8c03\u8bd5\u6a21\u5f0f\u662f\u9996\u8981\u6b65\u9aa4\u3002\u5728\u4f60\u7684 <code>wp-config.php<\/code> \u6587\u4ef6\u4e2d\uff0c\u5c06 <code>WP_DEBUG<\/code> \u5e38\u91cf\u8bbe\u7f6e\u4e3a <code>true<\/code>\u3002\u8fd9\u5c06\u76f4\u63a5\u5728\u9875\u9762\u4e0a\u663e\u793a PHP \u9519\u8bef\u3001\u8b66\u544a\u548c\u901a\u77e5\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u540c\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528 <code>error_log()<\/code> \u51fd\u6570\u5c06\u81ea\u5b9a\u4e49\u8c03\u8bd5\u4fe1\u606f\u5199\u5165\u670d\u52a1\u5668\u7684\u9519\u8bef\u65e5\u5fd7\uff0c\u6216\u8005\u4f7f\u7528\u6d4f\u89c8\u5668\u7684\u5f00\u53d1\u8005\u5de5\u5177\uff08\u63a7\u5236\u53f0\u548c\u7f51\u7edc\u9009\u9879\u5361\uff09\u6765\u8c03\u8bd5 JavaScript \u548c AJAX \u8bf7\u6c42\u3002\u5bf9\u4e8e\u590d\u6742\u7684\u903b\u8f91\uff0c\u4f7f\u7528\u5982 Xdebug \u7b49\u4e13\u4e1a\u8c03\u8bd5\u5de5\u5177\u4f1a\u4e8b\u534a\u529f\u500d\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u6211\u7684\u63d2\u4ef6\u4f1a\u548c\u4e3b\u9898\u6216\u5176\u4ed6\u63d2\u4ef6\u51b2\u7a81\u5417\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u6709\u53ef\u80fd\uff0c\u5c24\u5176\u662f\u5728\u5904\u7406\u76f8\u540c\u7684\u94a9\u5b50\u3001\u4f7f\u7528\u901a\u7528\u7684\u5168\u5c40\u53d8\u91cf\u540d\u6216\u7c7b\u540d\u65f6\u3002\u4e3a\u4e86\u6700\u5927\u7a0b\u5ea6\u51cf\u5c11\u51b2\u7a81\uff0c\u8bf7\u52a1\u5fc5\u4e3a\u4f60\u7684\u6240\u6709\u51fd\u6570\u3001\u7c7b\u3001\u53d8\u91cf\u548c\u9009\u9879\u540d\u6dfb\u52a0\u552f\u4e00\u7684\u524d\u7f00\u3002\u4f8b\u5982\uff0c\u4e0d\u8981\u4f7f\u7528 <code>add_footer_text<\/code>\uff0c\u800c\u662f\u4f7f\u7528\u7c7b\u4f3c <code>myplugin_add_footer_text<\/code> \u7684\u540d\u79f0\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u4fee\u6539\u5168\u5c40\u5185\u5bb9\uff08\u5982\u67e5\u8be2\u53d8\u91cf\uff09\u4e4b\u524d\uff0c\u8fdb\u884c\u5145\u5206\u7684\u68c0\u67e5\u548c\u6761\u4ef6\u9650\u5236\u3002\u5728\u53d1\u5e03\u524d\uff0c\u5c3d\u53ef\u80fd\u591a\u5730\u5728\u4e0d\u540c\u73af\u5883\u548c\u4e0d\u540c\u4e3b\u9898\u7ec4\u5408\u4e0b\u6d4b\u8bd5\u4f60\u7684\u63d2\u4ef6\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u6211\u9700\u8981\u5b66\u4e60\u54ea\u4e9b\u6280\u672f\u6765\u5f00\u53d1\u9ad8\u7ea7\u63d2\u4ef6\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u9664\u4e86\u624e\u5b9e\u7684 PHP \u57fa\u7840\uff0c\u4f60\u8fd8\u9700\u8981\u6df1\u5165\u4e86\u89e3\uff1a<br \/>\n- JavaScript\uff1a\u7528\u4e8e\u524d\u7aef\u4ea4\u4e92\u548c WordPress \u5b9a\u5236\u5668\u5f00\u53d1\u3002<br \/>\n- jQuery\uff1a\u5c3d\u7ba1 WordPress \u6b63\u5728\u5411\u73b0\u4ee3 JS \u6846\u67b6\u8fc7\u6e21\uff0c\u4f46 jQuery \u4ecd\u88ab\u5e7f\u6cdb\u4f7f\u7528\u3002<br \/>\n- REST API\uff1a\u7528\u4e8e\u521b\u5efa\u89e3\u8026\u7684\u524d\u7aef\u5e94\u7528\u6216\u4e0e\u5916\u90e8\u670d\u52a1\u4ea4\u4e92\u3002<br \/>\n- \u6570\u636e\u5e93\u77e5\u8bc6\uff1a\u4e86\u89e3 WordPress \u7684\u6570\u636e\u5e93\u7ed3\u6784\uff0c\u4ee5\u53ca\u5982\u4f55\u5b89\u5168\u5730\u8fdb\u884c\u81ea\u5b9a\u4e49\u67e5\u8be2\u6216\u521b\u5efa\u65b0\u8868\u3002<br \/>\n- Composer\uff1a\u7528\u4e8e\u7ba1\u7406 PHP \u4f9d\u8d56\u5305\u3002<br \/>\n- \u6784\u5efa\u5de5\u5177\uff1a\u5982 Webpack\uff0c\u7528\u4e8e\u7ba1\u7406\u73b0\u4ee3 JavaScript \u548c SASS \u7684\u7f16\u8bd1\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5982\u4f55\u5c06\u6211\u7684\u63d2\u4ef6\u53d1\u5e03\u5230 WordPress \u5b98\u65b9\u76ee\u5f55\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u7684\u63d2\u4ef6\u5b8c\u5168\u7b26\u5408\u5b98\u65b9\u7684\u63d2\u4ef6\u5f00\u53d1\u6307\u5357\u548c\u5b89\u5168\u6700\u4f73\u5b9e\u8df5\u3002\u4f60\u9700\u8981\u4e00\u4e2a WordPress.org \u8d26\u53f7\u3002\u5728\u8d26\u53f7\u4e0b\u63d0\u4ea4\u4f60\u7684\u63d2\u4ef6\u538b\u7f29\u5305\u8fdb\u884c\u5ba1\u6838\u3002\u5ba1\u6838\u8fc7\u7a0b\u4f1a\u68c0\u67e5\u4ee3\u7801\u8d28\u91cf\u3001\u5b89\u5168\u6027\u3001\u8bb8\u53ef\u8bc1\uff08\u5fc5\u987b\u662f GPL \u517c\u5bb9\uff09\u7b49\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u4f60\u7684\u63d2\u4ef6\u901a\u8fc7\u5ba1\u6838\uff0c\u5b83\u5c06\u88ab\u6dfb\u52a0\u5230 SVN \u4ed3\u5e93\u4e2d\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7 SVN \u6765\u66f4\u65b0\u548c\u7ef4\u62a4\u4f60\u7684\u63d2\u4ef6\u3002\u53d1\u5e03\u540e\uff0c\u7528\u6237\u5c31\u53ef\u4ee5\u76f4\u63a5\u5728\u4ed6\u4eec\u7684 WordPress \u540e\u53f0\u641c\u7d22\u3001\u5b89\u88c5\u548c\u66f4\u65b0\u4f60\u7684\u63d2\u4ef6\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0434\u043b\u044f WordPress \u0441 \u043d\u0443\u043b\u044f. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0440\u0435\u0434\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u0441\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043f\u043b\u0430\u0433\u0438\u043d\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442\u0441\u044f, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439. \u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u043a\u043e\u043d\u0435\u0446 \u0441\u0442\u0430\u0442\u044c\u0438 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0445\u0443\u043a\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 \u043f\u043b\u0430\u0433\u0438\u043d.<\/p>","protected":false},"author":7,"featured_media":0,"template":"","meta":{"_acf_changed":false,"footnotes":""},"tags":[2026,1978,436,366,2251],"knowledge_category":[280],"class_list":["post-12365723","knowledge_post","type-knowledge_post","status-publish","hentry","tag-php-programming","tag-wordpress-plugin-development","tag-wordpress-tutorial","tag-development-guide","tag-plugin-getting-started","knowledge_category-wordpress"],"acf":{"site_seo_keywords":"WordPress\u63d2\u4ef6\u5f00\u53d1, \u521b\u5efaWordPress\u63d2\u4ef6, \u63d2\u4ef6\u5f00\u53d1\u5165\u95e8, \u52a8\u4f5c\u94a9\u5b50, \u8fc7\u6ee4\u5668\u94a9\u5b50, \u4ece\u96f6\u5f00\u59cb\u5f00\u53d1\u63d2\u4ef6, \u7f16\u5199\u7b2c\u4e00\u4e2aWordPress\u63d2\u4ef6"},"_links":{"self":[{"href":"https:\/\/www.likacloud.com\/ru\/wp-json\/wp\/v2\/knowledge_posts\/12365723","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.likacloud.com\/ru\/wp-json\/wp\/v2\/knowledge_posts"}],"about":[{"href":"https:\/\/www.likacloud.com\/ru\/wp-json\/wp\/v2\/types\/knowledge_post"}],"author":[{"embeddable":true,"href":"https:\/\/www.likacloud.com\/ru\/wp-json\/wp\/v2\/users\/7"}],"version-history":[{"count":1,"href":"https:\/\/www.likacloud.com\/ru\/wp-json\/wp\/v2\/knowledge_posts\/12365723\/revisions"}],"predecessor-version":[{"id":12404006,"href":"https:\/\/www.likacloud.com\/ru\/wp-json\/wp\/v2\/knowledge_posts\/12365723\/revisions\/12404006"}],"wp:attachment":[{"href":"https:\/\/www.likacloud.com\/ru\/wp-json\/wp\/v2\/media?parent=12365723"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.likacloud.com\/ru\/wp-json\/wp\/v2\/tags?post=12365723"},{"taxonomy":"knowledge_category","embeddable":true,"href":"https:\/\/www.likacloud.com\/ru\/wp-json\/wp\/v2\/knowledge_category?post=12365723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}