Fix hardcoded dashboard expiration date format#2891
Merged
azaozz merged 3 commits intoAutomattic:trunkfrom Aug 25, 2025
Merged
Conversation
azaozz
requested changes
Aug 18, 2025
Contributor
azaozz
left a comment
There was a problem hiding this comment.
I'm pretty sure it is (almost) impossible to not have the date_format option set in WP, but just in case that happens somewhere this get_option() call will result in a trip to the DB (slow) and will return false which seems undesirable.
How about checking the option value before using it? Perhaps add something like:
$date_format = get_option( 'date_format' ) ?: 'M d, Y';
at the top then use $date_format in the HTML.
Contributor
Author
|
@azaozz definately a valid point! adjusted the code as per your suggestion and fixed the docblock as the title was also wrong there. hope thats fine inside the same PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2890
Changes Proposed in this Pull Request
Testing Instructions
After the fix it will be displayed according to your settings, in my example "j. F Y".

Release Notes
New or Updated Hooks and Templates
Deprecated Code
Screenshot / Video