You don’t need to change any code.
get_the_date without an argument will use the date_format option in your WordPress settings. The option F j, Y
will substitute F
as “September”, but if you have a translation of “September” it will be used.
Comments have suggested the use of date_i18n. This is used automatically when you call get_the_date(). Translations of the days and months are in WordPress core and will be used if installed. e.g. The Chinese translation of “September” is here,
However, if you want to print “2017年9月13” I think you will have to set a custom format in your WordPress settings as:
Y年m月d
Under Settings > General > Date Format, select “Custom” and enter that into the field. I’ve tested that and it formats the Chinese characters just fine.
Related Posts:
- gettext localization is not working
- How do I retrieve the slug of the current page?
- How to create .pot files with POedit?
- Most efficient way to get posts with postmeta
- Get posts by meta value
- Translate a plugin using .po .mo files
- Explanation of update_post_(meta/term)_cache
- How to extract data from a post meta serialized array?
- How to make a WordPress plugin translation ready?
- How to save an array with one metakey in postmeta?
- WordPress is stripping escape backslashes from JSON strings in post_meta
- Theme localization of “slugs” (custom post types, taxonomies)
- How can I get the post ID from a WP_Query loop?
- Check if Post Title exists, Insert post if doesn’t, Add Incremental # to Meta if does
- How to get a translated string from a language other than the current one?
- How to update_post_meta value as array
- Adding meta tag without plugin
- What’s the point of get_post_meta’s $single param?
- How to print translation supported text with HTML URL
- How to get a localized version of WordPress from a repository?
- Localization: I want the backend: english and frontend in defined language
- Working with l10n contexts (_x etc)
- What is the different between an attachment in wp_posts and an attachment in wp_postmeta?
- How to edit a post meta data in a Gutenberg Block?
- Sanitizing integer input for update_post_meta
- How to integrate get_post_time with date_i18n function?
- post formats – how to switch meta boxes when changing format?
- gettext does not translate when called in ajax
- Execute action after post is saved with all related post_meta records (data)
- Lack of composite indexes for meta tables
- How to provide translations for a WordPress TinyMCE plugin?
- How to escape the single quote character in i18n translation strings?
- Get a single post by a unique meta value
- if get_post_meta is empty do something
- How we get_post_meta without post id
- How get post id from meta value
- What is the code to get the download link for a product in WooCommerce?
- Safe to delete blank postmeta?
- advanced custom fields update_field for field type: Taxonomy
- update_post_meta not saving when value is zero
- Gettext details
- Content hooks vs User hooks
- Meta compare with date (stored as string) not working
- How to escape single and plural i18n text strings?
- Trying to get custom post meta through Jetpack JSON API [closed]
- Best pratice to make taxonomy terms translatable without changing slugs?
- How to update/insert custom field(post meta) data with wordpress REST API?
- Restrict post edit/delete based on user ID and custom field
- get_post_meta returning empty string when data shows in the database
- publish_post action hook doesn’t give post_meta_data
- Remove WordPress.org Meta link
- Remove post meta keys
- How to access the post meta of a post that has just been published?
- Why time functions show invalid time zone when using ‘c’ time format?
- Why is get_post_meta returning an array when I specify it as single?
- What is the purpose of an extra file for translation?
- What are the most used WordPress localization?
- How to update/delete array in post meta value?
- How to get all term meta for a taxonomy – getting term_meta for taxonomy
- Difference between 2 internationalization (i18n) functions __() & _e()
- Adding an assisting editor box to Post page
- delete unused postmeta
- Should I sanitize custom post meta if it is going to be escaped later?
- Problems with localization
- Localization works but still get “This plugin is not properly prepared for localization” msg in directory
- Add post meta based on another post meta value before publish post
- How do I retrieve multi-dimensional arrays from the wp_postmeta table, & display on a website?
- Front-end update_post_meta snippet displays white screen?
- Query between two meta values?
- Save both current and new version of post meta
- Get Advanced Custom Fields values before saving [closed]
- Give extra post-meta to RSS feeds
- How to get meta value in wp_attachment_metadata
- Best location for theme translation files
- WP REST API “rest_no_route” when trying to update meta
- Clean up output added via wp_head()
- List posts under meta_value heading
- Why am I getting an infinite loop with have_posts?
- `wp_set_script_translations` with `wp.i18n` does not return translated strings in simple plugin
- get_post_meta – get a single value
- delete value 0 in post meta [closed]
- Localization / textdomain is slow and chaotic
- Can I safely delete a record, manually, in the wp postmeta table?
- How to store post meta in an array?
- What action hook updates post meta?
- get_post_meta / update_post_meta array
- How to load theme textdomain from plugin?
- Change language of comments template
- adding a URL to a post meta
- Exclude a category from the filed under list
- Short of raw SQL, can I query for multiple attachment metadata that have a given array key?
- Can’t we use strings defined as PHP constants if we want to translate them in a plugin?
- get_the_date() for translating date format
- How do I access post meta data when publishing a new post in Gutenberg?
- update_post_meta() not working when used with WordPress action
- WordPress: After Gutenberg plugin migration to block.json the localization/ translations with PolyGlot in JavaScript does not work anymore
- Using Advanced Custom Field (ACF) to insert meta description on each page
- Triple meta_key on custom SELECT query
- get_post_custom()
- Adding meta data to an attachment post