Skip to navigation
How to log my WordPress plugin activity to a dedicated log file
18.06.23
## WordPress custom function to log your plugin activity ```php function bwc_log ($str) { $d = date("j-M-Y H:i:s e"); $path = get_home_path() . "wp-content/uploads/bwc.log"; if(! file_exists($path) ): fopen($path, "w"); endif; error_log("[$d] $str", 3, $path); } ``` ## Example call ```php bwc_log("...activate my foo plugin \n"); ```
https://infoheap.com/wordpress-custom-php-log-to-separate-file/
Reply
Anonymous
Information Epoch 1751542017
Think parallel.
Home
Notebook
Contact us