Jess G's BlogTutorials and Random Thoughts

Snarky Title Generator

What better way to cover those situations when you're feeling too lazy to title your posts.

<?php

add_filter('the_title', '_correct_empty_title', 10, 2);
/**
 * Add snarky filler title for posts without titles
 *
 * @param string $title WordPress post title
 * @param int $id WordPress post ID
 * @return string
 */
function _correct_empty_title($title, $id)
{
    if ($title === '') {
        $title = __('No Title; Author Too Lazy &hellip;');
    }

    return $title;
}