ドメインがマッピングされた wordpress マルチサイト インストール (バージョン 4.2.1) をインストールしました。
各サイトのブラウザに表示されるアップロードされた画像の URL はhttp://URL/wp-content/uploads/sites/SITENUMBER/DATE/...
で、フォルダは/path/to/wordpress/wp-content/uploads/sites/SITENUMBER/DATE/...
です。しかし、ローカル パスを使用して/path/to/wordpress/wp-content/uploads/sites/SITENUMBER/...
、ブラウザーで表示したいhttp://URL/wp-content/uploads/DATE/...
(単一のワードプレス サイトのように)。
私はそれについて多くのことを読みましたが、オプション「UPLOAD URL PATH」が通常これを書き換えるべきであることを知っていると思いますね。しかし、私にとってはうまくいきません。それに合わせてワードプレスをカスタマイズするにはどうすればよいですか?
更新: functions.php で、マルチサイトが URL の書き換えを取得するように定義されていることがわかりました。
// If multisite (and if not the main site in a post-MU network)
if ( is_multisite() && ! ( is_main_network() && is_main_site() && defined( 'MULTISITE' ) ) ) {
if ( ! get_site_option( 'ms_files_rewriting' ) ) {
/*
* If ms-files rewriting is disabled (networks created post-3.5), it is fairly
* straightforward: Append sites/%d if we're not on the main site (for post-MU
* networks). (The extra directory prevents a four-digit ID from conflicting with
* a year-based directory for the main site. But if a MU-era network has disabled
* ms-files rewriting manually, they don't need the extra directory, as they never
* had wp-content/uploads for the main site.)
*/
if ( defined( 'MULTISITE' ) )
$ms_dir = '/sites/' . get_current_blog_id();
else
$ms_dir = '/' . get_current_blog_id();
$dir .= $ms_dir;
$url .= $ms_dir;
...
}}
しかし、必要な動作を得るためにこれを変更する方法がわかりませんでした。