{"id":12361246,"date":"2026-03-11T08:13:08","date_gmt":"2026-03-11T00:13:08","guid":{"rendered":"https:\/\/www.likacloud.com\/knowledge\/%e6%8f%ad%e7%a7%98%e6%8f%92%e4%bb%b6%e5%bc%80%e5%8f%91%ef%bc%9a%e4%bb%8e%e9%9b%b6%e6%9e%84%e5%bb%ba%e4%bd%a0%e7%9a%84%e7%ac%ac%e4%b8%80%e4%b8%aa%e6%89%a9%e5%b1%95\/"},"modified":"2026-06-04T01:22:34","modified_gmt":"2026-06-03T17:22:34","slug":"plugin-development-guide-build-first-wordpress-extension","status":"publish","type":"knowledge_post","link":"https:\/\/www.likacloud.com\/fr\/knowledge\/wordpress\/plugin-development-guide-build-first-wordpress-extension\/","title":{"rendered":"D\u00e9couvrez les secrets du d\u00e9veloppement de plugins : construisez votre premi\u00e8re extension \u00e0 partir de z\u00e9ro."},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u63ed\u79d8\u63d2\u4ef6\u5f00\u53d1\uff1a\u4ece\u96f6\u6784\u5efa\u4f60\u7684\u7b2c\u4e00\u4e2a\u6269\u5c55<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">WordPress \u7684\u6838\u5fc3\u9b45\u529b\u5728\u4e8e\u5176\u6781\u5ea6\u7684\u53ef\u6269\u5c55\u6027\u3002\u901a\u8fc7\u5f00\u53d1\u81ea\u5b9a\u4e49\u63d2\u4ef6\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u65e0\u7f1d\u5730\u4e3a\u7f51\u7ad9\u6dfb\u52a0\u4efb\u4f55\u6240\u9700\u529f\u80fd\uff0c\u800c\u65e0\u9700\u4fee\u6539\u6838\u5fc3\u4ee3\u7801\uff0c\u786e\u4fdd\u4e86\u66f4\u65b0\u7684\u5b89\u5168\u6027\u4e0e\u4fbf\u6377\u6027\u3002\u672c\u6307\u5357\u5c06\u5f15\u5bfc\u4f60\u7cfb\u7edf\u5730\u4e86\u89e3 WordPress \u63d2\u4ef6\u5f00\u53d1\u7684\u57fa\u7840\u6d41\u7a0b\u3001\u67b6\u6784\u89c4\u8303\u4e0e\u6700\u4f73\u5b9e\u8df5\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u63d2\u4ef6\u5f00\u53d1\u7684\u6838\u5fc3\u57fa\u7840<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u52a8\u624b\u7f16\u5199\u4ee3\u7801\u4e4b\u524d\uff0c\u7406\u89e3 WordPress \u63d2\u4ef6\u7684\u57fa\u672c\u6982\u5ff5\u548c\u6807\u51c6\u7ed3\u6784\u81f3\u5173\u91cd\u8981\u3002\u4e00\u4e2a\u63d2\u4ef6\u672c\u8d28\u4e0a\u662f\u4e00\u4e2a\u6216\u591a\u4e2a PHP \u6587\u4ef6\uff0c\u5b83\u4eec\u88ab\u6253\u5305\u5728\u4e00\u4e2a\u76ee\u5f55\u4e2d\uff0c\u5e76\u5305\u542b\u4e00\u4e2a\u7279\u6b8a\u7684\u5934\u6ce8\u91ca\u6587\u4ef6\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u63d2\u4ef6\u7684\u4e3b\u6587\u4ef6\u6807\u51c6<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u6bcf\u4e2a\u63d2\u4ef6\u90fd\u5fc5\u987b\u62e5\u6709\u4e00\u4e2a\u4e3b PHP \u6587\u4ef6\u3002\u8fd9\u4e2a\u6587\u4ef6\u9700\u8981\u5305\u542b\u6807\u51c6\u7684\u63d2\u4ef6\u4fe1\u606f\u5934\uff0c\u4ee5\u4fbf WordPress \u80fd\u591f\u8bc6\u522b\u5e76\u7ba1\u7406\u5b83\u3002\u8fd9\u4e2a\u5934\u4fe1\u606f\u4ee5\u7279\u5b9a\u7684\u6ce8\u91ca\u5757\u5f62\u5f0f\u5b58\u5728\u3002\u4f8b\u5982\uff0c\u4e00\u4e2a\u540d\u4e3a <code>my-first-plugin.php<\/code> \u7684\u6587\u4ef6\u53ef\u80fd\u5305\u542b\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<!-- AUTO_INTERNAL_LINKS_START --><p>\u63a8\u8350\u9605\u8bfb <a href=\"https:\/\/www.likacloud.com\/de\/knowledge\/wordpress\/wordpress-theme-development-beginners-guide-e7-9f-a5-e8-af-86\/\">WordPress\u4e3b\u9898\u5f00\u53d1\u5165\u95e8\u6307\u5357\uff1a\u4ece\u96f6\u642d\u5efa\u4f60\u7684\u7b2c\u4e00\u4e2a\u4e3b\u9898<\/a>\u3002<\/p><!-- AUTO_INTERNAL_LINKS_END -->\n\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\u6f14\u793a\u7684 WordPress \u63d2\u4ef6\u3002\n * Version:           1.0.0\n * Author:            \u4f60\u7684\u540d\u5b57\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\">\u8fd9\u4e9b\u4fe1\u606f\u4f1a\u76f4\u63a5\u663e\u793a\u5728 WordPress \u540e\u53f0\u7684\u201c\u63d2\u4ef6\u201d\u7ba1\u7406\u9875\u9762\u4e2d\u3002\u5176\u4e2d\uff0c<code>Text Domain<\/code> \u548c <code>Domain Path<\/code> \u7528\u4e8e\u56fd\u9645\u5316\uff08i18n\uff09\uff0c\u4f7f\u63d2\u4ef6\u652f\u6301\u591a\u8bed\u8a00\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\/fr\/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\/fr\/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\/fr\/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\u76ee\u5f55\u4e0e\u6587\u4ef6\u7ec4\u7ec7<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e00\u4e2a\u7ed3\u6784\u826f\u597d\u7684\u63d2\u4ef6\u76ee\u5f55\u4e0d\u4ec5\u5229\u4e8e\u5f00\u53d1\u7ef4\u62a4\uff0c\u4e5f\u65b9\u4fbf\u7528\u6237\u7406\u89e3\u3002\u63a8\u8350\u9075\u5faa\u4ee5\u4e0b\u7ec4\u7ec7\u65b9\u5f0f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/my-first-plugin\/\n\u251c\u2500\u2500 my-first-plugin.php      \/\/ \u4e3b\u6587\u4ef6\n\u251c\u2500\u2500 uninstall.php            \/\/ \u5378\u8f7d\u6e05\u7406\u811a\u672c\n\u251c\u2500\u2500 includes\/                \/\/ \u6838\u5fc3\u529f\u80fd\u7c7b\u4e0e\u51fd\u6570\n\u2502   \u251c\u2500\u2500 class-core.php\n\u2502   \u2514\u2500\u2500 functions.php\n\u251c\u2500\u2500 admin\/                   \/\/ \u540e\u53f0\u76f8\u5173\u6587\u4ef6\n\u2502   \u251c\u2500\u2500 css\/\n\u2502   \u251c\u2500\u2500 js\/\n\u2502   \u2514\u2500\u2500 class-admin.php\n\u251c\u2500\u2500 public\/                  \/\/ \u524d\u53f0\u76f8\u5173\u6587\u4ef6\n\u2502   \u251c\u2500\u2500 css\/\n\u2502   \u251c\u2500\u2500 js\/\n\u2502   \u2514\u2500\u2500 class-public.php\n\u251c\u2500\u2500 assets\/                  \/\/ \u9759\u6001\u8d44\u6e90\uff08\u56fe\u7247\u7b49\uff09\n\u2514\u2500\u2500 languages\/               \/\/ \u7ffb\u8bd1\u6587\u4ef6\uff08.po, .mo\uff09<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u79cd\u5206\u79bb\u5f0f\u7ed3\u6784\u5c06\u540e\u53f0\u903b\u8f91\u3001\u524d\u53f0\u903b\u8f91\u548c\u516c\u5171\u8d44\u6e90\u6e05\u6670\u5730\u5206\u5f00\uff0c\u7b26\u5408 WordPress \u5f00\u53d1\u7684\u6700\u4f73\u5b9e\u8df5\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5229\u7528\u94a9\u5b50\u4e0e\u8fc7\u6ee4\u5668\u6269\u5c55\u529f\u80fd<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">WordPress \u7684\u63d2\u4ef6 API \u56f4\u7ed5\u201c\u94a9\u5b50\u201d\u6784\u5efa\uff0c\u8fd9\u662f\u5176\u4e8b\u4ef6\u9a71\u52a8\u67b6\u6784\u7684\u6838\u5fc3\u3002\u94a9\u5b50\u5206\u4e3a\u4e24\u79cd\uff1a\u52a8\u4f5c\u548c\u8fc7\u6ee4\u5668\u3002\u7406\u89e3\u5e76\u719f\u7ec3\u8fd0\u7528\u5b83\u4eec\u662f\u63d2\u4ef6\u5f00\u53d1\u7684\u5173\u952e\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u52a8\u4f5c\u94a9\u5b50\u7684\u8fd0\u7528<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u52a8\u4f5c\u94a9\u5b50\u5141\u8bb8\u4f60\u5728 WordPress \u6267\u884c\u7684\u7279\u5b9a\u65f6\u95f4\u70b9\u6dfb\u52a0\u81ea\u5b9a\u4e49\u4ee3\u7801\u3002\u4f8b\u5982\uff0c\u5f53\u6587\u7ae0\u53d1\u5e03\u65f6\uff0c\u6216\u5f53\u7ba1\u7406\u540e\u53f0\u83dc\u5355\u521d\u59cb\u5316\u65f6\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528 <code>add_action()<\/code> \u51fd\u6570\u5c06\u4f60\u7684\u51fd\u6570\u201c\u6302\u8f7d\u201d\u5230\u8fd9\u4e9b\u94a9\u5b50\u4e0a\u3002<\/p>\n<!-- AUTO_INTERNAL_LINKS_START --><p>\u63a8\u8350\u9605\u8bfb <a href=\"https:\/\/www.likacloud.com\/de\/knowledge\/website-building\/website-development-guide-planning-to-launch-process\/\">\u7f51\u7ad9\u5efa\u8bbe\u6280\u672f\u6307\u5357\uff1a\u4ece\u89c4\u5212\u5230\u4e0a\u7ebf\u7684\u5168\u6d41\u7a0b\u89e3\u6790<\/a>\u3002<\/p><!-- AUTO_INTERNAL_LINKS_END -->\n\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff0c\u5728\u7f51\u7ad9\u7684\u9875\u811a\u6dfb\u52a0\u4e00\u884c\u81ea\u5b9a\u4e49\u6587\u672c\u3002\u6211\u4eec\u9996\u5148\u5728\u4e3b\u63d2\u4ef6\u6587\u4ef6\u4e2d\u521b\u5efa\u4e00\u4e2a\u51fd\u6570\uff0c\u7136\u540e\u5c06\u5176\u6302\u8f7d\u5230 <code>wp_footer<\/code> \u8fd9\u4e2a\u52a8\u4f5c\u94a9\u5b50\u4e0a\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\u63d2\u4ef6\uff01&lt;\/p&gt;&#039;;\n}\nadd_action( &#039;wp_footer&#039;, &#039;myplugin_add_footer_text&#039; );<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f53 WordPress \u6267\u884c\u5230 <code>wp_footer<\/code> \u4f4d\u7f6e\u65f6\uff08\u901a\u5e38\u5728\u4e3b\u9898\u7684 <code>footer.php<\/code> \u4e2d\u8c03\u7528\uff09\uff0c\u6211\u4eec\u6dfb\u52a0\u7684\u51fd\u6570\u5c31\u4f1a\u88ab\u6267\u884c\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u8fc7\u6ee4\u5668\u94a9\u5b50\u7684\u8fd0\u7528<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fc7\u6ee4\u5668\u94a9\u5b50\u7528\u4e8e\u4fee\u6539\u5728\u6d41\u7a0b\u4e2d\u4f20\u9012\u7684\u6570\u636e\u3002\u5b83\u5141\u8bb8\u4f60\u62e6\u622a\u3001\u68c0\u67e5\u5e76\u4fee\u6539\u4e00\u4e2a\u53d8\u91cf\uff0c\u7136\u540e\u518d\u7531 WordPress \u6216\u5176\u4ed6\u63d2\u4ef6\u4f7f\u7528\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\/fr\/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\/fr\/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\/fr\/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\u4fee\u6539\u6587\u7ae0\u6807\u9898\u7684\u9ed8\u8ba4\u8f93\u51fa\uff0c\u5728\u6bcf\u4e2a\u6807\u9898\u524d\u52a0\u4e0a\u7279\u5b9a\u524d\u7f00\u3002\u6211\u4eec\u5c06\u51fd\u6570\u6302\u8f7d\u5230 <code>the_title<\/code> \u8fd9\u4e2a\u8fc7\u6ee4\u5668\u94a9\u5b50\u4e0a\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-php\">function myplugin_prefix_post_title( $title, $id = null ) {\n    \/\/ \u786e\u4fdd\u53ea\u5728\u4e3b\u5faa\u73af\u4e14\u5728\u975e\u7ba1\u7406\u540e\u53f0\u65f6\u6dfb\u52a0\u524d\u7f00\n    if ( ! is_admin() &amp;&amp; in_the_loop() ) {\n        $title = &#039;[\u63a8\u8350] &#039; . $title;\n    }\n    return $title;\n}\nadd_filter( &#039;the_title&#039;, &#039;myplugin_prefix_post_title&#039;, 10, 2 );<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u91cc\u7684\u53c2\u6570 <code>10<\/code> \u662f\u4f18\u5148\u7ea7\uff08\u6570\u5b57\u8d8a\u5c0f\u8d8a\u5148\u6267\u884c\uff09\uff0c<code>2<\/code> \u8868\u793a\u6211\u4eec\u7684\u51fd\u6570\u63a5\u53d7\u4e24\u4e2a\u53c2\u6570\uff08<code>$title<\/code> \u548c <code>$id<\/code>\uff09\u3002\u8fc7\u6ee4\u5668\u51fd\u6570\u5fc5\u987b\u8fd4\u56de\u4fee\u6539\u540e\u7684\u503c\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u521b\u5efa\u63d2\u4ef6\u7ba1\u7406\u9875\u9762<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u8bb8\u591a\u63d2\u4ef6\u9700\u8981\u5728 WordPress \u540e\u53f0\u63d0\u4f9b\u914d\u7f6e\u9009\u9879\u3002\u8fd9\u901a\u5e38\u901a\u8fc7\u5411\u7ba1\u7406\u83dc\u5355\u6dfb\u52a0\u9875\u9762\u6765\u5b9e\u73b0\u3002WordPress \u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u51fd\u6570\u6765\u521b\u5efa\u9876\u7ea7\u83dc\u5355\u3001\u5b50\u83dc\u5355\u4ee5\u53ca\u9009\u9879\u9875\u9762\u3002<\/p>\n<!-- AUTO_INTERNAL_LINKS_START --><p>\u63a8\u8350\u9605\u8bfb <a href=\"https:\/\/www.likacloud.com\/de\/knowledge\/wordpress\/woocommerce-custom-product-page-template-tutorial\/\">\u5b8c\u6574\u6559\u7a0b\uff1aWooCommerce \u81ea\u5b9a\u4e49\u4ea7\u54c1\u9875\u9762\u6a21\u677f\u63d0\u5347\u9500\u552e\u8f6c\u5316\u7387<\/a>\u3002<\/p><!-- AUTO_INTERNAL_LINKS_END -->\n\n\n\n\n<h3 class=\"wp-block-heading\">\u6dfb\u52a0\u9876\u7ea7\u7ba1\u7406\u83dc\u5355<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f60\u53ef\u4ee5\u4f7f\u7528 <code>add_menu_page()<\/code> \u51fd\u6570\u4e3a\u4f60\u7684\u63d2\u4ef6\u521b\u5efa\u4e00\u4e2a\u72ec\u7acb\u7684\u540e\u53f0\u83dc\u5355\u9879\u3002\u8fd9\u4e2a\u51fd\u6570\u9700\u8981\u591a\u4e2a\u53c2\u6570\u6765\u5b9a\u4e49\u9875\u9762\u7684\u6807\u9898\u3001\u83dc\u5355\u540d\u79f0\u3001\u6743\u9650\u3001\u552f\u4e00\u6807\u8bc6\u7b26\u3001\u56de\u8c03\u51fd\u6570\u7b49\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u9762\u7684\u4ee3\u7801\u5c55\u793a\u4e86\u5982\u4f55\u6dfb\u52a0\u4e00\u4e2a\u7b80\u5355\u7684\u9876\u7ea7\u83dc\u5355\u9875\u9762\uff0c\u5e76\u786e\u4fdd\u5b83\u53ea\u5728\u7ba1\u7406\u5458\u8bbf\u95ee\u65f6\u663e\u793a\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\/fr\/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\/fr\/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\/fr\/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<pre class=\"wp-block-code\"><code class=\"language-php\">function myplugin_add_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;,       \/\/ \u6743\u9650\u80fd\u529b\uff08\u901a\u5e38\u4e3a\u7ba1\u7406\u5458\uff09\n        &#039;myplugin-settings&#039;,    \/\/ \u83dc\u5355 Slug\n        &#039;myplugin_settings_page&#039;, \/\/ \u663e\u793a\u9875\u9762\u5185\u5bb9\u7684\u56de\u8c03\u51fd\u6570\n        &#039;dashicons-admin-generic&#039;, \/\/ \u56fe\u6807\uff08\u4f7f\u7528 Dashicons\uff09\n        30                      \/\/ \u83dc\u5355\u4f4d\u7f6e\n    );\n}\nadd_action( &#039;admin_menu&#039;, &#039;myplugin_add_admin_menu&#039; );\n\n\/\/ \u5b9a\u4e49\u8bbe\u7f6e\u9875\u9762\u7684\u5185\u5bb9\nfunction myplugin_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            settings_fields( &#039;myplugin_options&#039; ); \/\/ \u8f93\u51fa\u5b89\u5168\u5b57\u6bb5\n            do_settings_sections( &#039;myplugin-settings&#039; ); \/\/ \u8f93\u51fa\u8bbe\u7f6e\u533a\u5757\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\u91cc\uff0c<code>myplugin_settings_page<\/code> \u51fd\u6570\u8d1f\u8d23\u6e32\u67d3\u9875\u9762 HTML \u5185\u5bb9\u3002\u5b9e\u9645\u9879\u76ee\u4e2d\uff0c\u4f60\u4f1a\u7ed3\u5408 WordPress \u8bbe\u7f6e API\uff08<code>register_setting<\/code>, <code>add_settings_section<\/code>, <code>add_settings_field<\/code>\uff09\u6765\u521b\u5efa\u53ef\u4fdd\u5b58\u7684\u8868\u5355\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u6784\u5efa\u8868\u5355\u4e0e\u4fdd\u5b58\u8bbe\u7f6e<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e3a\u4e86\u5b89\u5168\u3001\u89c4\u8303\u5730\u5904\u7406\u7528\u6237\u8f93\u5165\uff0c\u5fc5\u987b\u4f7f\u7528 WordPress \u8bbe\u7f6e API\u3002\u5b83\u8d1f\u8d23\u975eces\u3001\u6570\u636e\u9a8c\u8bc1\u548c\u6570\u636e\u5e93\u5b58\u50a8\u3002\u9996\u5148\u9700\u8981\u6ce8\u518c\u4e00\u4e2a\u8bbe\u7f6e\u9009\u9879\uff0c\u7136\u540e\u6dfb\u52a0\u8bbe\u7f6e\u5b57\u6bb5\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u4e0b\u793a\u4f8b\u6f14\u793a\u4e86\u5982\u4f55\u6ce8\u518c\u4e00\u4e2a\u6587\u672c\u5b57\u6bb5\u5e76\u4fdd\u5b58\u5176\u503c\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-php\">function myplugin_settings_init() {\n    register_setting(\n        &#039;myplugin_options&#039;, \/\/ \u9009\u9879\u7ec4\u540d\n        &#039;myplugin_api_key&#039;, \/\/ \u9009\u9879\u540d\uff08\u5b58\u50a8\u5728 wp_options \u8868\u4e2d\uff09\n        array(\n            &#039;type&#039; =&gt; &#039;string&#039;,\n            &#039;sanitize_callback&#039; =&gt; &#039;sanitize_text_field&#039;, \/\/ \u6570\u636e\u6e05\u7406\u56de\u8c03\n            &#039;default&#039; =&gt; &#039;&#039;\n        )\n    );\n\n    add_settings_section(\n        &#039;myplugin_section_main&#039;,\n        &#039;\u4e3b\u8981\u8bbe\u7f6e&#039;,\n        null,\n        &#039;myplugin-settings&#039;\n    );\n\n    add_settings_field(\n        &#039;myplugin_field_api&#039;,\n        &#039;API \u5bc6\u94a5&#039;,\n        &#039;myplugin_field_api_cb&#039;,\n        &#039;myplugin-settings&#039;,\n        &#039;myplugin_section_main&#039;,\n        array( &#039;label_for&#039; =&gt; &#039;myplugin_api_key&#039; )\n    );\n}\nadd_action( &#039;admin_init&#039;, &#039;myplugin_settings_init&#039; );\n\nfunction myplugin_field_api_cb() {\n    $value = get_option( &#039;myplugin_api_key&#039;, &#039;&#039; );\n    echo &#039;&lt;input type=&quot;text&quot; id=&quot;myplugin_api_key&quot; name=&quot;myplugin_api_key&quot; value=&quot;&#039; . esc_attr( $value ) . &#039;&quot; class=&quot;regular-text&quot;&gt;&#039;;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u8868\u5355\u63d0\u4ea4\u7684\u6570\u636e\u4f1a\u7ecf\u8fc7 <code>sanitize_text_field<\/code> \u51fd\u6570\u6e05\u7406\uff0c\u7136\u540e\u81ea\u52a8\u4fdd\u5b58\u5230\u6570\u636e\u5e93\u7684 <code>wp_options<\/code> \u8868\u4e2d\uff0c\u952e\u540d\u4e3a <code>myplugin_api_key<\/code>\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u786e\u4fdd\u63d2\u4ef6\u7684\u5b89\u5168\u4e0e\u6027\u80fd<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f00\u53d1\u63d2\u4ef6\u65f6\uff0c\u5b89\u5168\u6027\u548c\u6027\u80fd\u662f\u4e0d\u53ef\u5ffd\u89c6\u7684\u6838\u5fc3\u8003\u91cf\u3002\u4e00\u4e2a\u4e0d\u5b89\u5168\u7684\u63d2\u4ef6\u53ef\u80fd\u6210\u4e3a\u6574\u4e2a WordPress \u7ad9\u70b9\u7684\u6f0f\u6d1e\u6765\u6e90\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u6570\u636e\u9a8c\u8bc1\u4e0e\u8f6c\u4e49<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u6c38\u8fdc\u4e0d\u8981\u76f8\u4fe1\u7528\u6237\u7684\u8f93\u5165\u3002\u6240\u6709\u6765\u81ea\u5916\u90e8\uff08\u5982\u8868\u5355\u3001URL\u3001\u6570\u636e\u5e93\uff09\u7684\u6570\u636e\u5728\u8f93\u51fa\u6216\u4f7f\u7528\u524d\u90fd\u5fc5\u987b\u7ecf\u8fc7\u9a8c\u8bc1\uff08Validation\uff09\u3001\u6e05\u7406\uff08Sanitization\uff09\u548c\u8f6c\u4e49\uff08Escaping\uff09\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u9a8c\u8bc1\uff1a\u68c0\u67e5\u6570\u636e\u662f\u5426\u7b26\u5408\u9884\u671f\u683c\u5f0f\uff08\u5982\u662f\u5426\u4e3a\u90ae\u7bb1\u3001\u6570\u5b57\uff09\u3002<\/li><li>\u6e05\u7406\uff1a\u79fb\u9664\u6570\u636e\u4e2d\u4e0d\u5141\u8bb8\u7684\u5b57\u7b26\u6216\u5185\u5bb9\uff08\u5982\u79fb\u9664 HTML \u6807\u7b7e\uff09\u3002<\/li><li>\u8f6c\u4e49\uff1a\u5728\u5c06\u6570\u636e\u8f93\u51fa\u5230 HTML\u3001JavaScript \u6216 URL \u65f6\uff0c\u8fdb\u884c\u7f16\u7801\u4ee5\u9632\u6b62\u8de8\u7ad9\u811a\u672c\u653b\u51fb\u3002<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">WordPress \u63d0\u4f9b\u4e86\u5927\u91cf\u8f85\u52a9\u51fd\u6570\uff0c\u4f8b\u5982\uff1a<br \/>\n*   <code>sanitize_text_field()<\/code>: \u6e05\u7406\u6587\u672c\u5b57\u7b26\u4e32\u3002<br \/>\n*   <code>esc_html()<\/code>: \u8f6c\u4e49 HTML \u8f93\u51fa\u3002<br \/>\n*   <code>esc_url()<\/code>: \u8f6c\u4e49 URL\u3002<br \/>\n*   <code>wp_kses_post()<\/code>: \u5141\u8bb8\u901a\u8fc7\u6587\u7ae0\u5185\u5bb9\u8fc7\u6ee4\u5668\u7684 HTML \u6807\u7b7e\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u811a\u672c\u4e0e\u6837\u5f0f\u7684\u6b63\u786e\u52a0\u8f7d<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e3a\u4e86\u4e0d\u5f71\u54cd\u9875\u9762\u52a0\u8f7d\u901f\u5ea6\u5e76\u907f\u514d\u51b2\u7a81\uff0cJavaScript \u548c CSS \u6587\u4ef6\u5fc5\u987b\u4f7f\u7528 WordPress \u63d0\u4f9b\u7684\u65b9\u6cd5\u6b63\u786e\u6ce8\u518c\u548c\u6392\u961f\u52a0\u8f7d\u3002\u4f7f\u7528 <code>wp_enqueue_script()<\/code> \u548c <code>wp_enqueue_style()<\/code> \u51fd\u6570\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u9762\u7684\u4ee3\u7801\u5c55\u793a\u4e86\u5982\u4f55\u4ec5\u5728\u63d2\u4ef6\u81ea\u5df1\u7684\u7ba1\u7406\u9875\u9762\u4e0a\u52a0\u8f7d\u4e13\u5c5e\u7684 JS \u548c CSS \u6587\u4ef6\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-php\">function myplugin_load_admin_assets( $hook ) {\n    \/\/ \u53ea\u5728\u6211\u4eec\u63d2\u4ef6\u7684\u8bbe\u7f6e\u9875\u52a0\u8f7d\n    if ( $hook != &#039;toplevel_page_myplugin-settings&#039; ) {\n        return;\n    }\n    wp_enqueue_style(\n        &#039;myplugin-admin-css&#039;,\n        plugins_url( &#039;admin\/css\/style.css&#039;, __FILE__ ),\n        array(),\n        &#039;1.0.0&#039;\n    );\n    wp_enqueue_script(\n        &#039;myplugin-admin-js&#039;,\n        plugins_url( &#039;admin\/js\/script.js&#039;, __FILE__ ),\n        array( &#039;jquery&#039; ), \/\/ \u58f0\u660e\u4f9d\u8d56 jQuery\n        &#039;1.0.0&#039;,\n        true \/\/ \u5728\u9875\u811a\u52a0\u8f7d\n    );\n}\nadd_action( &#039;admin_enqueue_scripts&#039;, &#039;myplugin_load_admin_assets&#039; );<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u79cd\u65b9\u5f0f\u786e\u4fdd\u4e86\u8d44\u6e90\u53ea\u5728\u9700\u8981\u65f6\u52a0\u8f7d\uff0c\u5e76\u4e14\u4f9d\u8d56\u5173\u7cfb\uff08\u5982 jQuery\uff09\u5f97\u5230\u6b63\u786e\u5904\u7406\uff0c\u540c\u65f6\u7248\u672c\u53f7\u53c2\u6570\u6709\u52a9\u4e8e\u7ba1\u7406\u6d4f\u89c8\u5668\u7f13\u5b58\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\u59cb\u4e8e\u5bf9\u6807\u51c6\u6587\u4ef6\u7ed3\u6784\u548c\u4fe1\u606f\u5934\u7684\u9075\u5b88\u3002\u5176\u7cbe\u9ad3\u5728\u4e8e\u719f\u7ec3\u8fd0\u7528\u52a8\u4f5c\u4e0e\u8fc7\u6ee4\u5668\u94a9\u5b50\uff0c\u4ee5\u975e\u4fb5\u5165\u7684\u65b9\u5f0f\u878d\u5165 WordPress \u7684\u751f\u547d\u5468\u671f\u3002\u4e3a\u63d2\u4ef6\u521b\u5efa\u6e05\u6670\u7684\u540e\u53f0\u7ba1\u7406\u754c\u9762\uff0c\u5e76\u4e25\u683c\u9075\u5b88\u8bbe\u7f6e API\uff0c\u80fd\u6781\u5927\u63d0\u5347\u7528\u6237\u4f53\u9a8c\u4e0e\u6570\u636e\u5b89\u5168\u3002\u6700\u540e\uff0c\u5c06\u5b89\u5168\u6027\uff08\u9a8c\u8bc1\u3001\u6e05\u7406\u3001\u8f6c\u4e49\uff09\u548c\u6027\u80fd\uff08\u6309\u9700\u52a0\u8f7d\u8d44\u6e90\uff09\u4f5c\u4e3a\u5f00\u53d1\u7684\u6838\u5fc3\u51c6\u5219\uff0c\u662f\u6784\u5efa\u9ad8\u8d28\u91cf\u3001\u53ef\u9760\u63d2\u4ef6\u7684\u4e0d\u4e8c\u6cd5\u95e8\u3002\u9075\u5faa\u8fd9\u4e9b\u6b65\u9aa4\u548c\u6700\u4f73\u5b9e\u8df5\uff0c\u4f60\u5c06\u80fd\u591f\u521b\u5efa\u51fa\u529f\u80fd\u5f3a\u5927\u3001\u5b89\u5168\u4e14\u6613\u4e8e\u7ef4\u62a4\u7684 WordPress \u6269\u5c55\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 WordPress \u63d2\u4ef6\u9700\u8981\u5177\u5907\u54ea\u4e9b\u57fa\u7840\u77e5\u8bc6\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f00\u53d1 WordPress \u63d2\u4ef6\u8981\u6c42\u4f60\u719f\u6089 PHP \u7f16\u7a0b\u8bed\u8a00\uff0c\u56e0\u4e3a\u63d2\u4ef6\u4e3b\u8981\u7531 PHP \u4ee3\u7801\u6784\u6210\u3002\u540c\u65f6\uff0c\u9700\u8981\u5bf9 HTML\u3001CSS \u548c JavaScript \u6709\u57fa\u672c\u4e86\u89e3\uff0c\u7528\u4e8e\u6784\u5efa\u524d\u7aef\u754c\u9762\u548c\u4ea4\u4e92\u3002\u6700\u91cd\u8981\u7684\u662f\uff0c\u4f60\u5fc5\u987b\u7406\u89e3 WordPress \u7684\u57fa\u672c\u67b6\u6784\uff0c\u7279\u522b\u662f\u5176\u94a9\u5b50\u7cfb\u7edf\uff08\u52a8\u4f5c\u548c\u8fc7\u6ee4\u5668\uff09\u3001\u4e3b\u9898\u6a21\u677f\u5c42\u7ea7\u4ee5\u53ca\u6570\u636e\u5e93\u64cd\u4f5c\uff08\u901a\u8fc7 <code>WP_Query<\/code> \u548c <code>wpdb<\/code> \u7c7b\uff09\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5982\u4f55\u8c03\u8bd5\u6b63\u5728\u5f00\u53d1\u7684 WordPress \u63d2\u4ef6\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u6700\u6709\u6548\u7684\u65b9\u6cd5\u662f\u5728\u4f60\u7684 <code>wp-config.php<\/code> \u6587\u4ef6\u4e2d\u542f\u7528 WordPress \u8c03\u8bd5\u6a21\u5f0f\u3002\u5c06 <code>WP_DEBUG<\/code> \u5e38\u91cf\u8bbe\u7f6e\u4e3a <code>true<\/code>\uff0c\u8fd9\u5c06\u5728\u9875\u9762\u4e0a\u663e\u793a PHP \u9519\u8bef\u3001\u8b66\u544a\u548c\u901a\u77e5\u3002\u4f60\u8fd8\u53ef\u4ee5\u4f7f\u7528 <code>error_log()<\/code> \u51fd\u6570\u5c06\u81ea\u5b9a\u4e49\u8c03\u8bd5\u4fe1\u606f\u8bb0\u5f55\u5230\u670d\u52a1\u5668\u7684\u9519\u8bef\u65e5\u5fd7\u4e2d\u3002\u5bf9\u4e8e\u66f4\u590d\u6742\u7684\u8c03\u8bd5\uff0c\u53ef\u4ee5\u8003\u8651\u4f7f\u7528\u4e13\u95e8\u7684 PHP \u8c03\u8bd5\u5de5\u5177\uff0c\u5982 Xdebug\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u63d2\u4ef6\u5e94\u8be5\u5982\u4f55\u5904\u7406\u6570\u636e\u5e93\u64cd\u4f5c\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5bf9\u4e8e\u7b80\u5355\u7684\u6570\u636e\u5b58\u50a8\uff0c\u63a8\u8350\u4f7f\u7528 WordPress \u7684\u9009\u9879 API\uff08<code>add_option<\/code>, <code>get_option<\/code>, <code>update_option<\/code>\uff09\u6765\u5b58\u50a8\u952e\u503c\u5bf9\u6570\u636e\u3002\u5bf9\u4e8e\u9700\u8981\u81ea\u5b9a\u4e49\u8868\u7684\u7ed3\u6784\u5316\u6570\u636e\uff0c\u4f60\u53ef\u4ee5\u5728\u63d2\u4ef6\u6fc0\u6d3b\u65f6\u4f7f\u7528 <code>dbDelta()<\/code> \u51fd\u6570\u6765\u5b89\u5168\u5730\u521b\u5efa\u6216\u66f4\u65b0\u8868\u7ed3\u6784\uff0c\u8fd9\u9700\u8981\u9075\u5faa\u7279\u5b9a\u7684 SQL \u683c\u5f0f\u3002\u52a1\u5fc5\u4f7f\u7528 <code>$wpdb<\/code> \u5168\u5c40\u5bf9\u8c61\u8fdb\u884c\u6240\u6709\u6570\u636e\u5e93\u67e5\u8be2\uff0c\u5e76\u5229\u7528\u5176 prepare \u65b9\u6cd5\u6765\u9632\u6b62 SQL \u6ce8\u5165\u653b\u51fb\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5982\u4f55\u8ba9\u6211\u7684\u63d2\u4ef6\u652f\u6301\u591a\u8bed\u8a00\u56fd\u9645\u5316\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">WordPress \u4f7f\u7528 GNU gettext \u6846\u67b6\u5b9e\u73b0\u56fd\u9645\u5316\u3002\u4f60\u9700\u8981\u5728\u63d2\u4ef6\u7684\u4e3b\u6587\u4ef6\u5934\u4fe1\u606f\u4e2d\u6b63\u786e\u8bbe\u7f6e <code>Text Domain<\/code> \u548c <code>Domain Path<\/code>\u3002\u5728\u4ee3\u7801\u4e2d\uff0c\u5c06\u6240\u6709\u9700\u8981\u7ffb\u8bd1\u7684\u5b57\u7b26\u4e32\u7528 <code>__()<\/code>\uff08\u7528\u4e8e\u8fd4\u56de\u503c\uff09\u6216 <code>_e()<\/code>\uff08\u7528\u4e8e\u76f4\u63a5\u8f93\u51fa\uff09\u7b49\u7ffb\u8bd1\u51fd\u6570\u5305\u88f9\u3002\u7136\u540e\uff0c\u4f7f\u7528\u5982 Poedit \u8fd9\u6837\u7684\u5de5\u5177\uff0c\u626b\u63cf\u6e90\u4ee3\u7801\u751f\u6210 <code>.pot<\/code> \u6a21\u677f\u6587\u4ef6\uff0c\u5e76\u57fa\u4e8e\u6b64\u521b\u5efa\u5404\u8bed\u8a00\u7684 <code>.po<\/code> \u548c <code>.mo<\/code> \u7ffb\u8bd1\u6587\u4ef6\uff0c\u5c06\u5176\u653e\u7f6e\u5728\u6307\u5b9a\u7684 <code>Domain Path<\/code> \u76ee\u5f55\u4e0b\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5f00\u53d1\u5b8c\u6210\u540e\uff0c\u5982\u4f55\u53d1\u5e03\u6211\u7684\u63d2\u4ef6\u5230\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\u300a\u63d2\u4ef6\u5f00\u53d1\u624b\u518c\u300b\u548c\u63d0\u4ea4\u8981\u6c42\uff0c\u5305\u62ec\u4ee3\u7801\u6807\u51c6\u3001\u5b89\u5168\u6027\u3001\u8bb8\u53ef\u534f\u8bae\uff08\u5fc5\u987b\u4e3a GPL \u517c\u5bb9\uff09\u7b49\u3002\u7136\u540e\uff0c\u5728 WordPress.org \u4e0a\u521b\u5efa\u4e00\u4e2a\u8d26\u6237\u5e76\u7533\u8bf7\u63d0\u4ea4\u63d2\u4ef6\u3002\u901a\u8fc7\u5ba1\u6838\u540e\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 Subversion \u5c06\u63d2\u4ef6\u4ee3\u7801\u63d0\u4ea4\u5230\u5b98\u65b9\u5206\u914d\u7684\u4ee3\u7801\u4ed3\u5e93\u3002\u63d0\u4ea4\u540e\uff0c\u4f60\u9700\u8981\u586b\u5199\u63d2\u4ef6\u7684\u63cf\u8ff0\u9875\uff0c\u5305\u62ec banner\u3001\u56fe\u6807\u3001\u622a\u56fe\u548c\u8be6\u7ec6\u8bf4\u660e\uff0c\u4ee5\u4f9b\u7528\u6237\u6d4f\u89c8\u548c\u4e0b\u8f7d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Cet article pr\u00e9sente les bases essentielles du d\u00e9veloppement de plugins pour WordPress, notamment l\u2019en-t\u00eate standard des fichiers de plugin, la structure de r\u00e9pertoire recommand\u00e9e, ainsi que la mani\u00e8re d\u2019utiliser les hooks d\u2019actions et de filtres pour \u00e9tendre les fonctionnalit\u00e9s d\u2019un plugin. L\u2019objectif est d\u2019aider les d\u00e9veloppeurs \u00e0 suivre les meilleures pratiques et \u00e0 construire syst\u00e9matiquement leur premier plugin personnalis\u00e9.<\/p>","protected":false},"author":7,"featured_media":0,"template":"","meta":{"_acf_changed":false,"footnotes":""},"tags":[118,560,712,1927,2020],"knowledge_category":[280],"class_list":["post-12361246","knowledge_post","type-knowledge_post","status-publish","hentry","tag-wordpress","tag-development-process","tag-tech-guide","tag-plugin-development","tag-software-architecture","knowledge_category-wordpress"],"acf":{"site_seo_keywords":"WordPress\u63d2\u4ef6\u5f00\u53d1,\u63d2\u4ef6\u5236\u4f5c\u6559\u7a0b,\u4ece\u96f6\u5f00\u59cb,\u94a9\u5b50\u4e0e\u8fc7\u6ee4\u5668,\u63d2\u4ef6\u67b6\u6784,\u81ea\u5b9a\u4e49\u529f\u80fd\u6269\u5c55,WordPress\u6269\u5c55\u5f00\u53d1\u6307\u5357"},"_links":{"self":[{"href":"https:\/\/www.likacloud.com\/fr\/wp-json\/wp\/v2\/knowledge_posts\/12361246","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.likacloud.com\/fr\/wp-json\/wp\/v2\/knowledge_posts"}],"about":[{"href":"https:\/\/www.likacloud.com\/fr\/wp-json\/wp\/v2\/types\/knowledge_post"}],"author":[{"embeddable":true,"href":"https:\/\/www.likacloud.com\/fr\/wp-json\/wp\/v2\/users\/7"}],"version-history":[{"count":1,"href":"https:\/\/www.likacloud.com\/fr\/wp-json\/wp\/v2\/knowledge_posts\/12361246\/revisions"}],"predecessor-version":[{"id":12404978,"href":"https:\/\/www.likacloud.com\/fr\/wp-json\/wp\/v2\/knowledge_posts\/12361246\/revisions\/12404978"}],"wp:attachment":[{"href":"https:\/\/www.likacloud.com\/fr\/wp-json\/wp\/v2\/media?parent=12361246"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.likacloud.com\/fr\/wp-json\/wp\/v2\/tags?post=12361246"},{"taxonomy":"knowledge_category","embeddable":true,"href":"https:\/\/www.likacloud.com\/fr\/wp-json\/wp\/v2\/knowledge_category?post=12361246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}