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
- Suppress deprecated notices
- What is the best way to monitor PHP functions/executions?
- 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?
- WSOD but WP_DEBUG not giving any errors
- WordPress “Link has expired” error on updating posts
- Does the debug.log do log rotation?
- Debugging an error: wp_enqueue_style was called incorrectly
- How do I set up Debugging?
- Disable Debug Log Programmatically
- get_the_content if it contains multiple lines it results in SyntaxError
- 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?
- How to resolve error “Cookies are blocked due to unexpected output.”?
- Enable errors PHP WordPress 5.2
- “Can’t use function return value in write context” error
- Fatal error: Call to undefined function wpsc_cart_item_count()
- Why when I instantiate wp_error in a validation method my user registration method stops working?
- Error when requesting password reset email – wp authentication
- Using FirePHP with WordPress
- Debugging PHP object during Ajax call in WordPress
- After upgrading to PHP 7.0 my contact form outputs error
- add_sub_menu page() to be replaced by add_theme_page()
- Does WordPress have a built in reference to the PHP version its running under? [closed]
- 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?
- how to trace notice warning on core function is_page() & is_singular in class-wp-query.php
- White Screen of Death – wp-admin
- Ajax return code 400
- 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
- get_term_link() returns correct – But illogical error-messages disturb
- PHP Warning: Attempt to read property “term_id” on bool
- 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
- Accessing Variables Used In a Plugin Using PHPStorm + XDebug
- Functions are causing errors
- Too few arguments for printf() [closed]
- syntax error unexpected ‘}’ at 364 line
- 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”
- Data inserted in database, but ajax calls error function
- Parse error: syntax error, unexpected ‘}’ in C:\wamp64\www\Proiect\aplicatie\user_check.php on line 18 [closed]
- Query Concatenation
- WP Debug enabled Undefined index error in a widget
- php 7.0 update to 7.1 and at least 7.2
- 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
- PHP warning Invalid argument supplied for foreach() on custom page template
- Please help! Parse error: syntax error, unexpected ‘
- Not able to see the error [closed]
- Need help with Deprecated: Non-static error when update PHP 7.4 -> 8.1 with Dyad 2 theme
- kali php problem [closed]
- PHP warning: Undefined array key 2 in feed.php
- PHP warning $post->ID is null
- Getting invalid user ID error when creating a new user with wp_insert_user
- Execute multiple PHP Snippets causes error?
- Use of undefined constant issue
- WordPress 6.1.1 shows deprecated errors with PHP 8.1 & 8.2
- I can’t log into my website , it says “Error: Cookies are blocked due to unexpected output”
- Internal server error when enabling Multisite in WordPress
- Error when loading Dashboard
- WordPress @include( ‘template-config.php’ );
- “Unexpected response from server” error when trying to upload any .mp4 file over 100MB
- taxonomy pages returning “NULL” when running default WordPress function ‘get_queried_object()’
- Undefined constant ABSPATH
- PHP Warning: Undefined array key “HTTP_REFERER”
- PHP Warning: Undefined array key “VirtualHostSubMenu” in index.php
- How do I see logs of critical errors of specific pages without enabling public debug for everyone?
- Headers already sent error
- Warning: Undefined variable $post_id
- “Object-cache.php” disables wp_cron and even disables my entire site, and keeps reappearing by itself again after I delete it
- Facing 503 error on PHP files after deleting hidden files from the root folder
- Critical Error on Pages – WP_DEBUG Not Showing Anything