I’m trying to write a plugin that’ll log every SQL query WP sends (for troubleshooting purposes). Looking at the query() function in wp-includes/wp-db.php in trunk seems to show that all SQL queries are run through the “query” filter.
So I added a function in my plugin called log_query(), and added this line in my plugin:
add_filter('query', array('Developer', 'log_query'));
However, this line causes WP to die for an unknown reason. Changing the filter name to any other known filter lets the PHP code run, but of course that doesn’t do what I want it to do. Is there any reason why this “query” filter doesn’t seem to be working?
- The topic ‘Problem using “query” filter’ is closed to new replies.