---
title: "How-to use custom PHP code snippets"
description: There might be a situation where you need to use some custom PHP code snippets on your site. We show you how to do it.
url: "https://mhthemes.com/support/knb/custom-php-code-snippets/"
updated: "2023-11-29"
category: "Extending & Styling"
---

# How-to use custom PHP code snippets

There might be a situation where you need to use some custom PHP code snippets on your site.

This could be done by adding the code into the *functions.php* of your child-/theme. Unfortunately, after changing your theme, your snippets will be gone too.

Alternatively, you could create your own plugin and collect those snippets inside. Of course, this requires deeper technical programming knowledge.

### The easy way of handling PHP code snippets

We recommend making use of a plugin called **[Code Snippets](https://wordpress.org/plugins/code-snippets/)** which is available for free.

After you installed and activated the plugin, you can find a new menu entry called "Snippets" on your left. Here you can add multiple snippets, control where the snippet should be executed, assign a title and description.

Additionally, you can easily deactivate snippets in order to pause their execution, without deleting them completely.
