2 Useful SQL Hacks For WordPress
I Love Mysql, love WordPress too :) Here i give to you 2 simple and useful sql hacks for WordPress. First one is about spam comments and delete them. Second one is show number of queries on your footer. You can apply from Mysql application. Lets Begin…
1st one; Delete your 5000 spam comments in 1 second :)
Yes you read it rightly. You can delete your spam comments from mysql in 1 second. Firstly you have to login to your Mysql Manager and integrate this lines from tab.
Here is the code:
DELETE from wp_comments WHERE comment_approved = '0';
That’s All! You delete your spam comments :)
2nd one; Show number of queries on your footer
You can show number of queries and query time on your template’s footer. That’s a simple code again and you have to edit your footer.php file. Add this lines to footer.php
Here is the code;
<?php if (is_user_logged_in()) { ?>
<?php echo get_num_queries(); ?> queries in <?php timer_stop(1); ?> seconds.
<?php } ?>
We add if_user_logged_in because we dont want to visitors see this line :)
That’s All. Have a nice day!

Recent Comments