The best way to apply changes to your WordPress site is to add them in parts/snippets without touching any files in a plugin or the theme your using. There are several functionality plugins available in the WordPress.org repository. The instructions below explain how to install and use a plugin called Code Snippets.Documentation Index
Fetch the complete documentation index at: https://docs.cocartapi.com/llms.txt
Use this file to discover all available pages before exploring further.
- Go to Plugins → Add New, search Code Snippets and install and activate the plugin. This will add a Snippets item to your wp-admin dashboard menu.
- Navigate to Snippets → Add New.
- Enter a title.
- Paste or type your code in the Code field.
- Click “Save Changes and Activate”.
Install via WP-CLI command.
If you have set a priority on the filter/hook. It is best that you set the priority at the same level. You also want to set/leave it on “Run snippet everywhere”.