constants

Fasten up WordPress

There is a constant that can limit WordPress to three simple things:

  • WP Class
  • DB Class and connection
  • Actions API

Nothing more will be loaded when you use this constant:

define( 'SHORTINIT', true );

This can be great to import or load raw data. It is good to use WordPress headless but better could be:

define( 'WP_USE_THEMES', true );

Everything will be loaded except the theme itself. Very nice for AJAX-Requests that just exchange data.

Another little help is to disable the WP cron. Replace it with a “normal” cron via server or URL call after this constant:

define( 'DISABLE_WP_CRON', true );

Usually the cron will be executed when you enter the backend. With very big cron jobs this can prostrate the page.

Usability and solid WordPress

WordPress offers some constants to simplify the live of the administrator. Those are not enabled by default because they are seen as a security issue. So once you activate them assure to establish other security provisions around them.

Trash for media files

First of all there is a trash for the media files that can be activated by one single linge:

define( 'MEDIA_TRASH', true );

Now every image and other files can be deleted and will be in a trash like posts or pages.

Allow any file type in WordPress

But not only images should be uploaded. Often the customer wants to upload exe and other files. You can allow that generally with this constant:

define( 'ALLOW_UNFILTERED_UPLOADS', true );

Now every admin can upload any file he wants.

Keep wp-content clean with every update

When deploying a new website you might like to get rid of Akismet, Hello Dolly and all Twenty* themes. So that your customer is not so confused. But with the next update those things appear again. Stop it with this constant:

define( 'CORE_UPGRADE_SKIP_NEW_BUNDLED', true );

WordPress now doesn’t copy any bundle (theme / plugin) that would come with an update. Your wp-content directory stays clean, no matter what.