How to Automatically Empty WordPress Trash Daily

Do you want to learn how to delete trash from WordPress on a daily basis? WordPress, like many other blogging platforms, is susceptible to spam. Deleting spam cannot only be a tedious task but also can also quickly fill up the WordPress trash with hundreds of deleted comments.

How often does WordPress delete trash?

WordPress deletes trash every 30 days. Therefore,all those comments that you had placed in the trash will eventually disappear. However, if you want your account to be more efficient or would prefer to see hundreds of messages in the trash be deleted on a regular basis, then there is a way.

How to empty WordPress trash daily

You can decide how often to delete your WordPress trash by adding this code in the WordPress root directory, under the wp-config.php file. The code is displayed below:

Define (‘ EMPTY_TRASH_DAYS ‘, 1 ) ;

The “1” in the code represents the frequency on how often the trash will deleted from WordPress. Therefore with “1” in the code, WordPress trash would be deleted every day but it can be changed to one’s preference. A “0” in the code however, will disable the automatic mechanism of deleting trash.

The server was not able to find the document (./502.shtml) you requested.

When I logon to webmail (eg: webmail.domain.net or webmail.domain.com), I successfully logon, get the option to select RoundCube, Horde or SquirrelMail but whenever I select any of them, I get an error page.

Content of Error:
***************
Not Found

The server was not able to find the document (./502.shtml) you requested.
Please check the url and try again. You might also want to report this
error to your web hosting provider.

webmaild/11.30.6.3 Server at webmail.domain.net, webmail.domain.net

Fix:

/usr/local/cpanel/scripts/makecpphp

I ran the above script to update cpanel php and the issue has fixed.

How to clear eximstats db

If the size of your eximstats database is getting large, you can do the following steps to clear it.

Login to mysql

mysql

mysql> use eximstats
mysql> delete from sends;
mysql> delete from smtp;
mysql> delete from failures;
mysql> delete from defers;

You can also use the following steps.

mysqladmin drop eximstats

mysqladmin create eximstats

mysql eximstats < /usr/local/cpanel/etc/eximstats_db.sql

Openvz + rsync problem Disk quota exceeded (122) error

I was rsyncing data from a server to a VPS. After some time, the following error occurred.

rsync: write failed on "/vz/private/106/mnt/sdb1/var/lib/mysql/ibdata1": Disk quota exceeded (122)
Inorder to fix this, add the following in /etc/vz/conf/106.conf where 106 is the container ID

DISK_QUOTA="no"
After saving the file, restart the vps using the following command
vzctl 106 restart
Now try rsync again and it will complete without any errors.

 

 

 

Website not showing the correct default page after restore

We had an issue recently where a site was not resolving to the correct default page after restoration. Upon checking, there were two files index.htm and index.html. The site was resolving from index.htm. In order to fix this open .htaccess file and add the following.

DirectoryIndex index.html index.htm

After this the site will load from index.html first.

 

Error in system filter: failed to open filter log file “/var/log/filter.log”

Error in system filter: failed to open filter log file “/var/log/filter.log”: Permission denied (euid=506 egid=559)

This error is basically due to improper ownership assigned to the file “/var/log/filter.log”.

Following fix can help to sort this problem:

Check the ownership assigned to the mentioned file
[root@server ~]# ls -l /var/log/filter.log
-rw-r–r– 1 root root 1004191 Feb 1 07:23 /var/log/filter.log

Now change the ownership of the file as follows:
[root@server ~]# chown cpaneleximfilter.cpaneleximfilter /var/log/filter.log

Now just restart the exim service and the problem should now be sorted.

Email forwarders not working irrespective of entry in /etc/valiases/domain

We encountered an issue lately where domain A was forwarded to domain B but mails were not forwarded. The two domains were in two different servers. I checked the front end and backend and apparently all entries were correct for email forwarders. Upon checking cPanel forums, they suggested checking permissions for /etc/valiases/domain which was 644 in server instead of 640 as recommended by cPanel.

root@host [/etc/valiases]# ls -lah mydomain.com

-rw-r—– 1 username mail 12 Aug 1 11:20 mydomain.com

Upon checking the logs, we found a weird matter which later proved vital. The logs for the domain A were not seen in server A when sent from an external domain. This led to the checking of the MX records and we found that the domain’s MX pointed to server C which also had a duplicate entry of domain A. So, we added forwarders in server C and the issue was solved.