<?php/** Absolute path to the WordPress directory. */if ( !defined('ABSPATH') )define('ABSPATH', dirname(__FILE__).'/wordpress/');/** Absolute path to the WordPress wp-content directory, which holds your themes, plugins, and uploads *///define( 'WP_CONTENT_DIR', dirname(__FILE__) . '/wp-content' );?>
SET @current ='http://some.example.com';SET @next ='https://www.example.com';UPDATE wp_options SET option_value =replace(option_value, @curent, @next) WHERE option_name ='home'OR option_name ='siteurl';UPDATE wp_posts SET post_content =replace(post_content, @curent, @next);UPDATE wp_postmeta SET meta_value =replace(meta_value,@curent,@next);UPDATE wp_usermeta SET meta_value =replace(meta_value, @curent,@next);UPDATE wp_links SET link_url =replace(link_url, @curent,@next);UPDATE wp_comments SET comment_content =replace(comment_content , @curent,@next);# For images inside postsUPDATE wp_posts SET post_content =replace(post_content, @curent, @next);# For images linked in old link managerUPDATE wp_links SET link_image =replace(link_image, @curent, @next);# For images linked as attachmentsUPDATE wp_posts SETguid=replace(guid, @curent, @next);# Serialized data via serialize() or json_encode() aren't touched, see https://deliciousbrains.com/wp-migrate-db-pro/doc/serialized-data/
Jekyll Exporter – WordPress plugin | WordPress.org - "One-click WordPress plugin that converts all posts, pages, taxonomies, metadata, and settings to Markdown and YAML which can be dropped into Jekyll (or Hugo or any other Markdown and YAML based site engine)"
<?php// In wp-content/mu-plugins/<pluginslug>/<pluginslug>.php (with a "loader" `wp-content/mu-plugins/<somename>.php`: `require WPMU_PLUGIN_DIR . '/<pluginslug>/<pluginslug>.php';`)add_action('muplugins_loaded',fn() => load_muplugin_textdomain('textdomain', dirname(plugin_basename(__FILE__)).'/languages'));// This will try to load `<WP_LANG_DIR>/plugins/<textdomain>-<locale>.mo` else `wp-content/mu-plugins/<pluginslug>/languages/<textdomain>-<locale>.mo`// Where `WP_LANG_DIR` is usually `wp-content/languages`?>
<?php// In wp-content/plugins/<pluginslug>/<pluginslug>.phpadd_action('init',fn() => load_plugin_textdomain('textdomain',false, dirname(plugin_basename(__FILE__)).'/languages'));// This will try to load `<WP_LANG_DIR>/plugins/<textdomain>-<locale>.mo` else `wp-content/plugins/<pluginslug>/languages/<textdomain>-<locale>.mo`// Where `WP_LANG_DIR` is usually `wp-content/languages`?>
<?php// In wp-content/themes/<themeslug>/functions.phpadd_action('after_setup_theme',fn() => load_theme_textdomain('textdomain', get_template_directory().'/languages'));// This will try to load `<WP_LANG_DIR>/themes/<textdomain>-<locale>.mo` else `wp-content/themes/<themeslug>/languages/<locale>.mo`// Where `WP_LANG_DIR` is usually `wp-content/languages`?>
See also _get_plugin_data_markup_translate(), for a plugin with meta comment Domain Path: /languages (default to empty) and Text Domain: text-domain (require, or no text domain will be (auto-)loaded) will load wp-content/plugin/<pluginslug><domainpath>/<textdomain>-<locale>.mo.
To debug which .mo files are loaded:
<?php$debuginfo_textdomain_mofiles = [];add_filter('load_textdomain_mofile',function ($mofile, $domain) {global $debug_textdomain_mofiles; $is_mofile_readable = is_readable($mofile); $mo =newMO(); $e =newException(); $debug_textdomain_mofiles[] = array('filename'=> $mofile,'domain'=> $domain,'readable'=> $is_mofile_readable,'trace'=> $e->getTraceAsString(),'importable'=> $is_mofile_readable && $mo->import_from_file($mofile) );return $mofile;},10,2);// Then later in page://var_dump($debuginfo_textdomain_mofiles);?>
Apache use a different group than FTP users. It's a safe measure, but updates can't be automatic (require SSH or FTP credentials). Ex: FTP: user 522/538; Apache/PHP: 48/48 (www-data)
#!/bin/bashUSER=userPASSWD=passwordSITE=www.example.com#DIR_MOD=0755DIR_MOD=0775#FILE_MOD=0644FILE_MOD=0664ROOT_DIR=/public_html# use `cat` instead of last command after the last pipe for dry-run{lftp<<EOFopen -u $USER,$PASSWD $SITEfind $ROOT_DIRexitEOF} |gawk'BEGIN { print "open -u '$USER','$PASSWD' '$SITE'" } { if (match($0 ,/\/$/)) printf "chmod '$DIR_MOD' \"%s\"\n", $0; else printf "chmod '$FILE_MOD' \"%s\"\n", $0 } END { print "exit" }'|lftp
The Code is in get_filesystem_method(). Wordpress tries to create a file 'wp-content/temp-write-test-'.time()