wp search-replace --dry-run 'oldprefix_' 'newprefix_'
wp db export
wp core update
Notes about WordPress Gutenberg themes development.
.htaccess (1) ACF (6) admin (1) ajax (2) api (1) API interactivity (1) block (18) block_style (2) colors (2) constante (1) context (1) conventions (2) cron (1) css (5) custom post type (1) data (1) debug (2) define (1) file_API (1) functions.php (5) git (4) hook (7) i18n (2) js (2) layout (1) loop (1) media (1) media library (1) menu (2) navigation (1) patterns (1) performance (2) post (1) query (3) readmore (1) responsive (1) rest api (1) scss (1) security (7) spacing (1) sql (1) svg (1) taxonomy (1) theme (1) theme.json (11) typo (2) URL (1) wp-config.php (6) wp cli (3) wp function (7)
wp search-replace --dry-run 'oldprefix_' 'newprefix_'
wp db export
wp core update
Note: check for updatedl10n.php
and wp i18n make-php
command → https://make.wordpress.org/core/2024/02/27/i18n-improvements-6-5-performant-translations/
Used to generate translations from __('string to translate', 'text-domain')
functions.
MO files: MO, or Machine Object is a binary data file that contains object data referenced by a program. It is typically used to translate program code, and may be loaded or imported into the GNU gettext program.
PO files: PO files are the files which contain the actual translations. Each language will have its own PO file, for example, for French there would be a fr.po file, for german there would be a de.po, for American English there might be en-US.po.
POT file: POT files are the template files for PO files. They will have all the translation strings left empty. A POT file is essentially an empty PO file without the translations, with just the original strings.
wp i18n make-pot . languages/<file-name>.pot --domain=<domain-name>
wp i18n update-po languages/<file-name>.pot languages/fr_FR.po
wp i18n make-mo languages/<file-name>.po languages/
wp i18n make-php languages/
It is possible to specify a specific Domain Path in style.css
: Defaults to /languages
.
The Text Domain
has to be specified in the style.css
file.
The function load_theme_textdomain( $text_domain, $path );
needs to be called with the after_setup_theme
hook.
Sources:
To install wp cli
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
# test
wp --info
source : https://make.wordpress.org/cli/handbook/guides/installing/