Title: insert code snippet via CLI or programmatically
Last modified: April 3, 2024

---

# insert code snippet via CLI or programmatically

 *  [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * (@helgatheviking)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/insert-code-snippet-via-cli-or-programmatically/)
 * hi, so I’m working on setting up a plugin preview using the WordPress playground
   blueprint.json.
 * I’d like to activate a snippet in the build process. Is there any way to activate
   a snippet via wp-cli?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/insert-code-snippet-via-cli-or-programmatically/#post-17549823)
 * Unfortunately, we currently only have wp-cli support in the Pro plugin.
 * I can see the argument to including it in the core version as well, especially
   if it’s commands like ‘activate’. I’m guessing that’s what you’d need to use 
   it in blueprint.json?
 *  Thread Starter [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * (@helgatheviking)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/insert-code-snippet-via-cli-or-programmatically/#post-17549846)
 * Thanks Shea! I would need to add and activate a snippet, yes. Could I import 
   it via .xml? Are snippets exportable? Worst case, I think I could wrap it up 
   as it’s own standalone plugin and install it that way… just exploring this option
   first.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘insert code snippet via CLI or programmatically’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * Last activity: [2 years, 2 months ago](https://wordpress.org/support/topic/insert-code-snippet-via-cli-or-programmatically/#post-17549846)
 * Status: not a support question