Wordpress | |更改默认上载文件夹(无定义) 我正在使用Wordpress 5.5 安装(全新无插件无任何内容) 我还在学习php,所以(如果我问了任何关于这个主题的愚蠢问题,我深表歉意)

Wordpress | |更改默认上载文件夹(无定义) 我正在使用Wordpress 5.5 安装(全新无插件无任何内容) 我还在学习php,所以(如果我问了任何关于这个主题的愚蠢问题,我深表歉意),php,wordpress,Php,Wordpress,这就是交易; 我已经为这个问题寻找了大约两天的解决方案 我得到了一些有用的答案,但不是我需要的 我想更改wordpress目录中的默认主文件夹上载 在说之前,请在\wp config.php 我不是在寻找定义新文件夹的代码,我想从wordpress核心更改它 我不是在寻找这个补丁define('UPLOADS','images') 是的,我知道,核心文件中的任何更改都将在新的wordpress更新中更改,不要担心,这是我最不关心的 所以我试着在wordpress代码中找到的一些文件夹中更改ur

这就是交易; 我已经为这个问题寻找了大约两天的解决方案 我得到了一些有用的答案,但不是我需要的

我想更改wordpress目录中的默认主文件夹上载 在说之前,请在
\wp config.php


我不是在寻找定义新文件夹的代码,我想从wordpress核心更改它

我不是在寻找这个补丁
define('UPLOADS','images')

是的,我知道,核心文件中的任何更改都将在新的wordpress更新中更改,不要担心,这是我最不关心的

所以我试着在wordpress代码中找到的一些文件夹中更改url

我希望它位于的上载路径

wordpress/mwis/uploads


wp admin/options-media.php

Some Details might be helpful

第二文件

wordpress/wp admin/options.php


在WP中这样做的正确方法是使用提供的挂钩。
   19  $media_options_help = '<p>' . __( 'You can set maximum sizes for images inserted into your written content; you can also insert an image as Full Size.' ) . '</p>';
   20  
   21: if ( ! is_multisite() && ( get_option( 'upload_url_path' ) || ( get_option( 'upload_path' ) != 'mwis/uploads' && get_option( 'upload_path' ) ) ) ) {
   22   $media_options_help .= '<p>' . __( 'Uploading Files allows you to choose the folder and path for storing your uploaded files.' ) . '</p>';
   23  }
   ..
  110   /*
  111    * If upload_url_path is not the default (empty),
  112:   * or upload_path is not the default ('mwis/uploads' or empty),
  113    * they can be edited, otherwise they're locked.
  114    */
  115:  if ( get_option( 'upload_url_path' ) || ( get_option( 'upload_path' ) != 'mwis/uploads' && get_option( 'upload_path' ) ) ) :
  116       ?>
  117  <tr>
  ...
  120  <p class="description">
  121       <?php
  122:      /* translators: %s: mwis/uploads */
  123:      printf( __( 'Default is %s' ), '<code>mwis/uploads</code>' );
  124       ?>
  125  </p>
180     /*
  181    * If upload_url_path is not the default (empty),
  182:   * or upload_path is not the default ('mwis/uploads' or empty),
  183    * they can be edited, otherwise they're locked.
  184    */
  185:  if ( get_option( 'upload_url_path' ) || ( get_option( 'upload_path' ) != 'mwis/uploads' && get_option( 'upload_path' ) ) ) {
  186       $allowed_options['media'][] = 'upload_path';
  187       $allowed_options['media'][] = 'upload_url_path';