> For the complete documentation index, see [llms.txt](https://knowledgebase.ajaxsearchpro.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://knowledgebase.ajaxsearchpro.com/safe-coding-guideline.md).

# Safe Coding Guideline

## How do I implement the suggested custom codes?

Most section of this knowledge base involve custom codes, that need to be implemented either [via a code snippets plugin](https://snipcraftpro.com/) or placed in your theme/child theme **functions.php (not recommened)**

{% hint style="danger" %}
Before starting with any of the listed methods, **make sure to have a full website back-up just in case**. You never know what you may accidentally delete or change.
{% endhint %}

### Via SnipCraft Code Snippets plugin (Recommented)

This method is much easier, most snippets should work all right with it.

* Download and install the [SnipCraft](https://snipcraftpro.com/) plugin
* Use the plugin back-end to add and manage custom codes
* IMPORTANT: Make sure the snippet is set to **run everywhere**<br>

<figure><img src="/files/pLEmY60FghVKsWyzO8nY" alt=""><figcaption></figcaption></figure>

### Theme or Child theme functions.php file (Advanced)

This method is safer as you have direct access to the files and any issues can be undone quickly. However switching the theme will also turn off all custom codes, as they have to be carried over to the new theme.

* Optimally, you should use a [child theme](https://www.smashingmagazine.com/2016/01/create-customize-wordpress-child-theme/). Child theme files does not change during theme updates, leaving the changes in tact.
* Open up the **functions.php** file in your active theme/child theme directory via an (s)FTP file editor. Notepad++, Filezilla and WinSCP are great tools for that. We do not recommend using the theme editor that wordpress offers, for safety reasons. [Tutorial here](https://www.converticacommerce.com/support-maintenance/how-to-edit-functions-php-in-wordpress/).
* The file is usually located at **wp-content/themes/your-current-theme/functions.php**
* Place the recommended code snippet at the bottom of that file.
* Save, and it is done

###
