Change Blog Post Date Format in Manual Mode: Custom Code Fix
In this article
If you need to change the date format of a blog post while using manual mode, the fix is a small custom code snippet that overrides the default date output. This article explains exactly where to add that code in WordPress, how to adjust it for your preferred format, and what to do if it does not work.
Why Manual Mode Overrides Date Settings
Many WordPress themes and page builders include a “manual mode” for post meta, which lets you control which elements (date, author, categories) appear. However, manual mode typically uses a hard-coded date format from the theme’s template file, ignoring the global “Date Format” setting under Settings > General. So even if you change the site-wide format, the post still shows the theme’s default, often like “January 1, 2024” or “01/01/2024”. The custom code fix works by filtering the date output specifically for posts where manual mode is active.
How the Custom Code Fix Works
WordPress provides two primary functions for displaying dates: get_the_date() and the_date(). Themes use one or both. The custom code hooks into these functions using the the_date and get_the_date filters. The filter receives the formatted date string and the original format string, so you can replace the format before it is echoed.
Here is the core snippet you would add to your theme’s functions.php file or a site-specific plugin:
add_filter( 'the_date', 'custom_manual_date_format', 10, 2 );
add_filter( 'get_the_date', 'custom_manual_date_format', 10, 2 );
function custom_manual_date_format( $the_date, $format ) {
// Only apply if format is empty (theme default)
if ( empty( $format ) ) {
return get_the_time( 'F j, Y' );
}
return $the_date;
}This checks whether the theme passed a format. If it did not (which is common in manual mode), it replaces the date with your chosen format. You can change 'F j, Y' to any valid PHP date format string, such as 'd/m/Y' for day/month/year or 'Y-m-d' for ISO 8601.
Choosing the Right Date Format String
PHP date format characters are case-sensitive. The most common ones are:
d– day of the month, two digits (01–31)j– day of the month without leading zeros (1–31)m– month as a number (01–12)n– month without leading zeros (1–12)F– full month name (January)M– three-letter month (Jan)Y– four-digit yeary– two-digit yearl– full weekday name (Monday)D– three-letter weekday (Mon)
For example, to display “2024-01-05”, use 'Y-m-d'. To display “5 Jan 2024”, use 'j M Y'. To display “Friday, January 5, 2024”, use 'l, F j, Y'.
Always test the output on a staging site first, because a wrong character (like using M instead of m) can produce unexpected results.
Where to Add the Code Safely
You have three main options for adding the snippet:
- Child theme’s functions.php – Best practice if you are using a child theme. Add the code at the end of the file, before the closing PHP tag (if present).
- Site-specific plugin – Create a new plugin file and place the code there. This keeps the code active even if you switch themes.
- Code Snippets plugin – If you prefer a UI, install a plugin like “Code Snippets” and add the snippet there. This avoids editing theme files directly.
If you edit the parent theme’s functions.php directly, your change will be lost on the next theme update. Always use a child theme or a plugin for long-term fixes.
Common Problems and Troubleshooting
If the date still does not change, check these issues:
- Theme uses a different function – Some themes use
get_post_time()orget_the_time()directly. You may need to filter those as well, or find the template file that outputs the date and edit it. - Format is not empty – The theme might pass a format like
'M j, Y'. In that case, yourempty($format)check fails. Instead, you can force a format regardless:return get_the_time( 'F j, Y' );without the conditional. - Caching – Your site or browser might be serving a cached version. Clear all caches (plugin, server, browser) after adding the code.
- Plugin conflict – Another plugin might be modifying the date output. Temporarily deactivate other plugins to test.
If the above does not work, the theme likely outputs the date in a template file (like single.php or content.php). In that case, you need to edit that template directly, which is more involved but gives you full control.
Comparison: Custom Code vs. Theme Settings
Most themes offer a “Post Meta” or “Blog Layout” setting where you can choose the date format from a dropdown. This is the easiest method, but it is limited to the formats the theme provides. Custom code gives you unlimited flexibility, but requires a small amount of PHP knowledge. If you are comfortable editing code, the custom snippet is more reliable because it works regardless of theme updates. If you prefer a no-code solution, look for a theme setting that matches your desired format.
Safety and Backup Considerations
Before editing any theme file, create a full backup of your site (files and database). A syntax error in functions.php can cause a white screen or “critical error” message. If that happens, you can restore the backup or use FTP to remove the offending code. Always test the snippet on a staging site first if possible. Also, note that the code only affects front-end display; it does not change the stored date in the database, so it is safe for SEO and sorting.
Frequently Asked Questions
Will this change the date in the WordPress admin?
No, the filter only applies to the front-end output. The admin area uses its own formatting, so your post list will still show the site-wide format. If you want to change the admin format, you would need to modify the manage_posts_columns or use a plugin like “Admin Columns”.
Can I use different formats for different posts?
Yes, but you would need to add a conditional inside the function. For example, check the post ID or a custom field. Without that, the same format applies to all posts.
Does this work with page builders like Elementor or Beaver Builder?
It depends on how the builder outputs the date. If the builder uses get_the_date() or the_date(), the filter will work. If it uses its own widget with a separate date function, you may need to look for a hook specific to that builder. Most popular builders use the standard WordPress functions, so the snippet usually works.
What if the date shows as “January 1, 2024” but I want “01/01/2024”?
Change the format string in the snippet to 'd/m/Y' (or 'm/d/Y' for US style). The filter will replace the default with your chosen format.
Is there a way to do this without a child theme?
Yes, a site-specific plugin is a safe alternative. It keeps your code separate from the theme, so it survives theme updates. You can create a simple plugin with just the snippet and activate it.