How to find line of code causing wordpress deprecation notices

The reason why the error message refers to a line in a WordPress core file instead of a theme or plugin is because it’s within the function itself that the error occurs, not in the place where add_option() is called.

If you want to be able to trace through the code to discover the originating file, you can use an extension like xdebug, which will allow you to generate a stack trace, like this one:

example xdebug stack trace

From this we can see that the offending plugin is called example.php, and the function that calls add_option incorrectly is called some_buggy_function().

As far as fixing the error itself, previous versions of WordPress used a third argument to add_option which is now deprecated. Removing that argument or setting it to an empty string '' will remove the warning.