I had a similar problem: calling error_log()
from wp-config.php
works, but calling it from functions.php
does not work for me.
I couldn’t solve this issue but I’ve found a workaround that allowed me to do some sort of debugging at least. I gave up on error_log()
and just wrote an own function that logs into a given file:
function mylog($txt) {
file_put_contents('/home/myuser/logs/mylog.txt', $txt.PHP_EOL , FILE_APPEND | LOCK_EX);
}
Related Posts:
- “Undefined index” error when saving empty array with checkboxes
- error_log() output for print_r() appearing on page
- Hide php Notices in Dashboard
- “Notice: Undefined variable: content” is showing [closed]
- Same log message keeps on printing to debug.log file thousand of times
- How to find error in my code when the error message is pointing to WP core file?
- Mute Debug Messages from Plugins
- XAMPP-VM Mac OS Mojave wordpress debugging using XDebug
- How to display only specific Error types in debug.log? No notices, warnings, etc
- Notice: Undefined index: post_title error
- WordPress won’t display errors at all
- WordPress White Screen Error
- How to fix the admin menu margin-top bug in WordPress 5.5?
- Should I use spl_autoload_register() in my plugin?
- WP-CLI – Selecting PHP version
- When to use Exceptions vs Error Objects vs just plain false/null
- PHP Catchable fatal error: Object of class WP_Error could not be converted to string
- Upgrading PHP version results in “Use of undefined constant WP_CONTENT_DIR” warning?
- WordPress “Link has expired” error on updating posts
- Debugging an error: wp_enqueue_style was called incorrectly
- How do I set up Debugging?
- Disable Debug Log Programmatically
- Where exactly do I write define( ‘WP_DEBUG’, true ) in wp-config file
- Utilize WP-CLI from inside WordPress, not SSH
- Notice: Constant already defined in wp-config.php on (non-existent) line?
- “Can’t use function return value in write context” error
- Error when requesting password reset email – wp authentication
- add_sub_menu page() to be replaced by add_theme_page()
- mysqli_real_connect() – authentication method unknown to the client Warnings
- How to debug php code in hostgator cPanel
- Can WordPress email the admin about PHP errors, while hiding them from the site?
- Preferred Method of debugging a wordpress SQL calls?
- Get PHP Fatal error on globalized $wpdb: Call to a member function insert() on a non-object- I have no clue. What to do?
- How to show the error causing the ‘There has been a critical error on your website’?
- Huge debug.log because of “undefined offset in media.php”
- WordPress 5 WP REST routes – No errors
- How do you change error reporting to only show errors in WordPress?
- WordPress Script stops suddenly
- A non-numeric value encountered in /wp-includes/functions.php on line 68
- Error on wp_default_style After upgrade to php 7
- Getting error when using wp_insert_post()
- Headers already sent in Pluggable.php / homepage and wp-login error
- Why does WordPress keep showing me error messages?
- Site throws 500 error after upgrading from PHP 5.6 to 7.X
- Warning: Illegal string offset on theme options page [closed]
- customize wordpress database error page
- PHP if statement works in template files, but not header
- Getting a WordPress Debug Strategy
- PHP-warning in post-template.php and no loading content on pages
- After adding my website to a new server, I keep getting a unexpected end of file error, but the file is identitcal to it’s original source
- Parse error: syntax error, unexpected ‘}’ [closed]
- Array to string conversion error in PHP 7.2 when returning user role as class
- PHP E_WARNING being shown despite php.ini [closed]
- Hooks for post saving make a post-new.php to load latest post’s data
- can’t get errors
- Fatal Error wp-settings.php on line 119
- Trying to display terms from custom taxonomy within function
- Help with accessing wp-admin page and resolving error messages
- Blog suddenly shows Archive instead of index page
- Programmatically revert to backup .htaccess a possibility?
- Prevent post from being published and show error
- WordPress 6.x / PHP 8.x deprecated warnings in development environment
- Illegal string offset in PHP function in via Theme Customizer
- Can’t log in to WordPress wp-admin after adding code to functions.php
- Cannot find the php_ini configuration file to find my error log to see why my code is not working
- White screen after migrating site, but wp-admin works fine. Disabling all plugins, applying default theme and enabling debug mode does nothing
- I am having errors with checkout on wordpress
- Intermittent 503 Service Unavailable Error
- var_dump() and print_r() display null in php
- Fatal error: wp-settings.php on line 199
- WordPress Bad Request Error 400
- Trying to get property ‘ID’ and ‘post_author’ of non-object error
- HELP: cannot log into wordpress. PHP error
- PHP error on local server install
- Site title not showing. Please help me
- PHP Error in WordPress Theme
- WordPress database error only while loading page for 1st time
- This occurs when I open admin or front on localhost
- How to send logs to plugin owner for a plugin?
- (Xdebug Profiler) Why are there two cachegrind files generated for one page?
- Plugin debugging with errors in activation routine
- WordPress 3.0 PHP Error – notice WordPress_product_Type was called incorrectly
- Stripe button is not working in a template page
- Unnessary character on post after restore
- How to find the function which is outputting Array
- WordPress causing all code to be displayed on line 1. Receiving multiple errors after cleaning cookies and cache
- Warning: Cannot modify header information (with a twist)
- Troubleshooting “loopback requests that take too long”
- Query Concatenation
- WP Debug enabled Undefined index error in a widget
- What does that mean: cannot use a scalar value as an array [closed]
- How to quickly/easily make an analysis (reverse engineering) of WordPress?
- problem with php function error
- How to handle PHP parse errors?
- which php or css file has generated an inline style in WordPress that overwrites my css
- Please help! Parse error: syntax error, unexpected ‘
- PHP warning $post->ID is null
- Getting invalid user ID error when creating a new user with wp_insert_user
- Use of undefined constant issue
- Error when loading Dashboard