Remove dates from WordPress post titles the easy way

While searching for a way to remove dates from WordPress titles, you probably came across some code to put into functions.php of your theme. Here’s a better solution.

The wrong tutorials suggest adding this

function jl_remove_post_dates() {
	add_filter('the_date', '__return_false');
	add_filter('the_time', '__return_false');
	add_filter('the_modified_date', '__return_false');
	add_filter('get_the_date', '__return_false');
	add_filter('get_the_time', '__return_false');
	add_filter('get_the_modified_date', '__return_false');
} add_action('loop_start', 'jl_remove_post_dates');

to the top of Theme Functions file. Even though this works, it disrupts core WordPress functions, which may lead to unstable performance.
Other tutorials suggest going through all .php files in your theme and clearing out date references, which is time consuming and leaves a lot of space for errors.

A better solution will be editing content.php of you theme. Find this line:

printf( __( 'Posted by %1$s on %2$s', 'something' ),

The first variable is the author, the second is the date. Make it look like this

printf( __( 'Posted by %1$s', 'something' ),

to remove the dates from WordPress titles, without destabilizing the CMS.

Leave a Comment