{"id":126,"date":"2025-08-18T12:22:37","date_gmt":"2025-08-18T06:22:37","guid":{"rendered":"https:\/\/ronniee.net\/?p=126"},"modified":"2025-09-17T12:54:49","modified_gmt":"2025-09-17T06:54:49","slug":"how-to-generate-pot-file-for-a-custom-wp-plugin-using-wp-cli","status":"publish","type":"post","link":"https:\/\/ronniee.net\/?p=126","title":{"rendered":"how to generate .pot file for a custom WP plugin using WP cli"},"content":{"rendered":"\n<p>If you want to keep WP-CLI local and run with <code>php wp-cli.phar<\/code>, here\u2019s what you do:<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Download WP-CLI locally<\/h3>\n\n\n\n<p>Inside your WordPress project root (where <code>wp-config.php<\/code> lives):<\/p>\n\n\n\n<p>curl -O https:\/\/raw.githubusercontent.com\/wp-cli\/builds\/gh-pages\/phar\/wp-cli.phar<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Run WP-CLI with PHP<\/h3>\n\n\n\n<p>Instead of <code>wp<\/code>, use:<\/p>\n\n\n\n<p>php wp-cli.phar &#8211;info<\/p>\n\n\n\n<p>That should print WP-CLI version + PHP info.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Generate the <code>.pot<\/code> file<\/h3>\n\n\n\n<p>Now, run the <code>i18n make-pot<\/code> command like this:<\/p>\n\n\n\n<p>php wp-cli.phar i18n make-pot . languages\/my-plugin.pot &#8211;domain=my-plugin &#8211;exclude=node_modules,vendor,tests<\/p>\n\n\n\n<p><code>.<\/code> \u2192 scan current directory<\/p>\n\n\n\n<p><code>languages\/my-plugin.pot<\/code> \u2192 output file<\/p>\n\n\n\n<p><code>--domain=my-plugin<\/code> \u2192 your plugin\/theme text domain<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you want to keep WP-CLI local and run with php wp-cli.phar, here\u2019s what you do: 1. Download WP-CLI locally Inside your WordPress project root (where wp-config.php lives): curl -O https:\/\/raw.githubusercontent.com\/wp-cli\/builds\/gh-pages\/phar\/wp-cli.phar 2. Run WP-CLI with PHP Instead of wp, use: php wp-cli.phar &#8211;info That should print WP-CLI version + PHP info. 3. Generate the .pot [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-126","post","type-post","status-publish","format-standard","hentry","category-wordpress"],"_links":{"self":[{"href":"https:\/\/ronniee.net\/index.php?rest_route=\/wp\/v2\/posts\/126","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ronniee.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ronniee.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ronniee.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ronniee.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=126"}],"version-history":[{"count":1,"href":"https:\/\/ronniee.net\/index.php?rest_route=\/wp\/v2\/posts\/126\/revisions"}],"predecessor-version":[{"id":127,"href":"https:\/\/ronniee.net\/index.php?rest_route=\/wp\/v2\/posts\/126\/revisions\/127"}],"wp:attachment":[{"href":"https:\/\/ronniee.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=126"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ronniee.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=126"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ronniee.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}