Where to put code that customizes API

Typically changes like this you would either create a plugin or create a child theme and put your code in your child theme’s functions.php file. You make changes to a child theme because if your theme updates you will lose any changes you have made directly to it.

Code in a plugin is always run as long as the plugin is active, where as code in a theme or child theme won’t work if you change themes down the road. If the changes you want to make are not theme specific its probably best to just create a small plugin. Which is really nothing more than adding a comment at the top of a PHP file.

Here is an example plugin…

<?php
    /*
        Plugin Name: Example Plugin
    */

    // Your PHP here

Name this file, something like example-plugin.php, put it in the plugin directory then activate it in the admin.

Here is some info on creating a child theme.

Good article on plugins vs themes.