Documentation, Reference Materials, and Tutorials for WPCode
Would you like to see exactly what your code snippets are reporting, without opening a single file on your server?
In this guide, we’ll walk you through turning on WPCode’s snippet error logging and reading the results from your WordPress admin.
Before you get started, make sure WPCode is installed and activated on your WordPress site.
To get started, we’ll turn logging on so WPCode has somewhere to keep the record.
Error logging keeps a written record of everything your snippets report. It puts that record in your WordPress admin, instead of a file you need FTP to reach. The switch starts off, so nothing is recorded until you turn it on.
From your WordPress admin sidebar, go to Code Snippets » Settings. Then select the Error Handling tab.

The Error Handling tab holds every setting to do with snippet errors. The logging switch comes first. The email options follow underneath it.

At the top of the tab, switch Error Logging on.

With this on, WPCode writes each entry to a log file in your uploads folder. The Logs tab reads those files back for you.
The description beside the switch carries a View Logs link that jumps straight to that tab. That saves a trip through the menu once entries start arriving.
Note: Logging starts when you save, so the logs cover what your snippets report from that point on.
At the bottom of the panel, click Save Changes.

Your error logging settings are now saved.
Requirements: Email notifications are available in the paid versions of WPCode.
The logs wait for you to come and read them. WPCode can also come to you by emailing you the moment it writes an entry. The rest of the Error Handling tab covers that.
Under the Email Notifications heading, switch Error Notifications on.

Each email names the snippet involved and links to its edit screen, so you can go from the message to the code in one click.
In the Send To field, enter the addresses that will receive those emails.

Your site’s admin email address is there to begin with. The field takes a comma-separated list, so both a developer and the site owner can get the same email. The emails go to whatever addresses the field holds when you save.
To see how one of these messages is laid out before you ever receive one, click Preview Email. It opens a sample in a new browser tab.

Deactivation Notifications covers the second message WPCode can send. To be told whenever WPCode takes a snippet out of service on its own, switch it on.

It has its own Send To field and its own Preview Email button, so the two message types can go to different people. When you’ve set both the way you want them, click Save Changes.

Your notification settings are now saved, and you’re ready to read what WPCode has recorded.
Everything WPCode records is readable from the admin, so you never need to download a file to see it.
From your WordPress admin sidebar, go to Code Snippets » Tools. Then select the Logs tab.

The tab opens on the first log it finds and shows its contents straight away.
Note: If you have only just switched logging on, the tab tells you no logs were found until your snippets report something.
The filename appears as the heading. Beside it, the Delete log button removes the file you’re looking at. We cover that in the Removing a Log section below.
The picker on the right lists every log WPCode holds. The panel underneath holds the entries themselves.

WPCode starts a fresh log file for each day. The date is part of the filename, so the list doubles as a timeline.
Two kinds of file can appear in that list.
To read a different day or a different snippet, choose its file from the picker. Then click View.

The panel then holds the entries from the file you picked.
Every line follows the same shape: a full timestamp, then the message WPCode received. The timestamp tells you when the entry was written, down to the second. The message is the part that tells you what your code was doing.
Some messages name something specific, such as a function. That name is a shortcut back to the code, because the snippets list searches the code inside your snippets as well as their titles.
Searching Code Snippets for that name will turn up the snippet holding it.
For more on tracing a message back to the snippet that produced it, see our guide on debugging PHP errors in WPCode.
Once you’ve finished with a log, clearing it out keeps the picker down to the days you care about.
With the log you want on screen, click Delete log beside its filename.

Your browser asks you to confirm before anything is deleted. Once confirmed, WPCode removes that one file. The rest of your logs stay exactly as they were.
That’s it! You now have a written record of what your snippets report, a way to have it delivered to your inbox, and somewhere in the admin to read it. Next, our guide on PHP error handling and safe mode shows how WPCode keeps your admin reachable while you work through a log.
Below, we’ve answered some of the most common questions about WPCode’s snippet error logging.
In a folder named wpcode-logs inside your WordPress uploads directory. WPCode creates that folder the first time it needs it. At the same time it adds an index.html and a .htaccess file, so the contents aren’t served to visitors.
Because WPCode keeps a combined log alongside the per-snippet ones. The file whose name starts with error collects everything reported that day. A file whose name starts with snippet covers a single snippet, and carries that snippet’s ID in its name.
No. Once a day’s file passes WPCode’s size limit, WPCode starts a new one. It keeps the earlier files beside it with a numbered suffix, up to ten of them.
The Logs tab checks the same permission WPCode uses for editing PHP snippets, so a user needs that permission to read a log. The Access Control tab shows which roles hold it, and lets you change them.
No. WPCode sends each one as it records the entry, so the email arrives at the same time as the log line.
The subject line names your site and the ID of the snippet involved. The body gives you the snippet’s title as a link to its edit screen, the address the entry was recorded on when WPCode has one, and the full message.
No. When WPCode has taken a snippet out of service, it sends the deactivation message for that event rather than the error message. Each type carries its own subject line, so the two are easy to tell apart in your inbox.
A short line telling you no logs were found, with a link back to the Error Handling tab so you can check the switch. Once a file exists but happens to be empty, the tab names the file and tells you the log is empty.
Future-proof your website with WPCode Snippets and improve the way you manage code across all your websites.