USP Pro automatically records the date and time for each submitted post. When a post is submitted, USP Pro creates a custom field named usp-post-time and attaches it to the post (you can view this and other custom fields on the “Edit Post” screen for any submitted post). This quick tutorial provides a code snippet that enables you to customize the format of the date and time for any field handled by USP Pro.

Default date/time format

By default, USP Pro formats the submitted date and time as Monday, March 10, 2025 @ 05:49:37 pm. Other custom fields (such as any date field) will format the date like 2025-06-17, depending on configuration, browser, device, and other variables.

Custom date/time format

To customize the default date/time format, add the following custom code to your site (note: here is a guide that explains how to add custom code to WordPress). You can add this via your theme functions.php or via simple plugin.

function usp_pro_update_post_meta($content) {
	
	if (is_single()) {
		
		$post_id = get_the_ID();
		
		$meta_key = 'usp-custom-1'; // // <-- custom field name
		
		$date_format = 'Y/m/d H:i:s'; // <-- preferred date format
		
		$date = get_post_meta($post_id, $meta_key, true);
		
		if ($date) {
			
			$date = date_create($date);
			
			$date = date_format($date, $date_format);
			
			$added = update_post_meta($post_id, $meta_key, $date);
			
		}
		
	}
	
	return $content;
	
}
add_filter('the_content', 'usp_pro_update_post_meta');

There are two things that need modified for this code to work:

Custom field name — to get this, submit a test post and visit the post in the WP Admin Area on the “Edit Post” screen. There you can toggle open the Custom Fields meta box, where all of the post’s custom fields will be displayed. So find the one that contains the date/time that you want to format, and add it to the above code (next to where it says “custom field name”).

Date/time format — this can be whatever format you would like, check the official PHP docs for a list of all accepted parameters for date/time. Once you have the format you would like, add it to the code above (next to where it says “preferred date format”).

Save changes, upload, and done. Of course, remember to test well before going live. To test, you can submit a few test posts and examine the date/time custom field formats via the Edit Post screen.

Note: this technique applies only to fields handled directly by USP Pro. For other date/time fields, you will need to consult with WordPress handbook or the documentation for whichever plugin or theme is responsible.

Related