{"id":18959168,"date":"2026-07-08T08:02:05","date_gmt":"2026-07-08T08:02:05","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/profiling-a-wp-cli-command\/"},"modified":"2026-07-08T08:02:05","modified_gmt":"2026-07-08T08:02:05","slug":"profiling-a-wp-cli-command","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/profiling-a-wp-cli-command\/","title":{"rendered":"Profiling a WP-CLI command"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hi! How are you?<br \/>I tried to find a way to profile a custom WP-CLI command, but that&#8217;s kind of hard.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As in, maybe a Trait one could <code>use<\/code> in your custom Command and call <code>$this-&gt;start_profiling('profile-name');<\/code> before you logic starts and optional a <code>$this-&gt;end_profiling();<\/code> ?<br \/>Example of a simple, but effective Trait I built a while ago <a href=\"https:\/\/github.com\/jmslbam\/wp-cli-base-command\/blob\/main\/src\/Bulk_Task.php\">https:\/\/github.com\/jmslbam\/wp-cli-base-command\/blob\/main\/src\/Bulk_Task.php<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Kind regards,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Jaime Martinez<\/p>\n","protected":false},"template":"","class_list":["post-18959168","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18959168","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18959168\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=18959168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}