Limit WordPress Image Upload Size

function ter_limit_image_uploads($file){
$error_message = 'KB is to large. Please reduce the file size of your image to ' . TER_MAX_IMAGE_SIZE_KB . 'KB or less. Hosting space is limited and uploading large images will slow down your page loads. Use a tool such as to help you to resize your images. Target size: Width 1024px, file size 100KB-200KB';
$size_in_kb = $file['size'] / 1024;
if(preg_match('/image/',$file['type'])) if($size_in_kb > TER_MAX_IMAGE_SIZE_KB) $file['error'] = round($size_in_kb,2) . $error_message;
return $file;
add_filter('wp_handle_upload_prefilter','ter_limit_image_uploads'); //Limit uploaded image size

Get the content


$content = get_the_content();
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]&gt;', $content);


Hide Private Posts

function hide_posts($where){
if( is_admin() ) return $where;
global $wpdb;
return " $where AND {$wpdb->posts}.post_status != 'private' ";


Exclude pages filter

function exclude_pages($pages){
//Use if no pages are excluded yet
$pages = array(39,40);

//Use this for adding pages to exclude
$exclude = 212;
return $pages;