Tag: Codex

Neat and Useful wp-config Settings

There are a ton of great options available for you to put into your wp-config.php file which can help your site run smoother, give you that extra customization you wanted without the use of plugins, and aid in development and debugging.

Here are some highlights that can help save you time and headaches by adding the following to your wp-config.php file:

Help for the Average User

  • Change the Autosave Interval: define(‘AUTOSAVE_INTERVAL’, 30 ); (30 = 30 seconds)
  • Disable Post Revisions: define(‘WP_POST_REVISIONS’, false );
  • Modify Empty Trash Time: define(‘EMPTY_TRASH_DAYS’, 7 ); (7 = 7 days)
  • Auto Optimize Your Database: define(‘WP_ALLOW_REPAIR’, true);
  • Enable the Cache:define(‘WP_CACHE’, true);
  • Define Maximum # of Revisions:define(‘WP_POST_REVISIONS’, 5);

Help for Developers

  • Output Errors:define(‘WP_DEBUG’, true);
  • Save Queries for Analysis:define(‘SAVEQUERIES’, true);
  • Define WP Site URL (override settings):define(‘WP_SITEURL’, ‘http://’ . $_SERVER[‘SERVER_NAME’] . ‘/path/to/wordpress’); – great for moving sites from one host to another when the actual domain name is not yet available
  • Define WP Home (override settings):define(‘WP_HOME’, ‘http://’ . $_SERVER[‘HTTP_HOST’] . ‘/path/to/wordpress’); – great for moving sites from one host to another when the actual domain name is not yet available

Full documentation is available: http://codex.wordpress.org/Editing_wp-config.php

Get Category Name By ID (WordPress)

I have been working on a new WordPress theme (to be released this week) and in one of the admin screens – I needed to get the category name by using the category ID. To do this (in or outside of the loop):

<?php get_cat_name( $cat_id ) ?>

Super simple – super helpful.

Reference: http://codex.wordpress.org/Function_Reference/get_cat_name