[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-admin/ -> options-permalink.php (source)

   1  <?php
   2  /**
   3   * Permalink Settings Administration Screen.
   4   *
   5   * @package WordPress
   6   * @subpackage Administration
   7   */
   8  
   9  /** WordPress Administration Bootstrap */
  10  require_once  __DIR__ . '/admin.php';
  11  
  12  if ( ! current_user_can( 'manage_options' ) ) {
  13      wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
  14  }
  15  
  16  // Used in the HTML title tag.
  17  $title       = __( 'Permalink Settings' );
  18  $parent_file = 'options-general.php';
  19  
  20  get_current_screen()->add_help_tab(
  21      array(
  22          'id'      => 'overview',
  23          'title'   => __( 'Overview' ),
  24          'content' => '<p>' . __( 'Permalinks are the permanent URLs to your individual pages and blog posts, as well as your category and tag archives. A permalink is the web address used to link to your content. The URL to each post should be permanent, and never change &#8212; hence the name permalink.' ) . '</p>' .
  25              '<p>' . __( 'This screen allows you to choose your permalink structure. You can choose from common settings or create custom URL structures.' ) . '</p>' .
  26              '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
  27      )
  28  );
  29  
  30  get_current_screen()->add_help_tab(
  31      array(
  32          'id'      => 'permalink-settings',
  33          'title'   => __( 'Permalink Settings' ),
  34          'content' => '<p>' . __( 'Permalinks can contain useful information, such as the post date, title, or other elements. You can choose from any of the suggested permalink formats, or you can craft your own if you select Custom Structure.' ) . '</p>' .
  35              '<p>' . sprintf(
  36                  /* translators: %s: Percent sign (%). */
  37                  __( 'If you pick an option other than Plain, your general URL path with structure tags (terms surrounded by %s) will also appear in the custom structure field and your path can be further modified there.' ),
  38                  '<code>%</code>'
  39              ) . '</p>' .
  40              '<p>' . sprintf(
  41                  /* translators: 1: %category%, 2: %tag% */
  42                  __( 'When you assign multiple categories or tags to a post, only one can show up in the permalink: the lowest numbered category. This applies if your custom structure includes %1$s or %2$s.' ),
  43                  '<code>%category%</code>',
  44                  '<code>%tag%</code>'
  45              ) . '</p>' .
  46              '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
  47      )
  48  );
  49  
  50  get_current_screen()->add_help_tab(
  51      array(
  52          'id'      => 'custom-structures',
  53          'title'   => __( 'Custom Structures' ),
  54          'content' => '<p>' . __( 'The Optional fields let you customize the &#8220;category&#8221; and &#8220;tag&#8221; base names that will appear in archive URLs. For example, the page listing all posts in the &#8220;Uncategorized&#8221; category could be <code>/topics/uncategorized</code> instead of <code>/category/uncategorized</code>.' ) . '</p>' .
  55              '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
  56      )
  57  );
  58  
  59  $help_sidebar_content = '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
  60      '<p>' . __( '<a href="https://wordpress.org/documentation/article/settings-permalinks-screen/">Documentation on Permalinks Settings</a>' ) . '</p>' .
  61      '<p>' . __( '<a href="https://wordpress.org/documentation/article/customize-permalinks/">Documentation on Using Permalinks</a>' ) . '</p>';
  62  
  63  if ( $is_nginx ) {
  64      $help_sidebar_content .= '<p>' . __( '<a href="https://developer.wordpress.org/advanced-administration/server/web-server/nginx/">Documentation on Nginx configuration</a>.' ) . '</p>';
  65  }
  66  
  67  $help_sidebar_content .= '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>';
  68  
  69  get_current_screen()->set_help_sidebar( $help_sidebar_content );
  70  unset( $help_sidebar_content );
  71  
  72  $home_path           = get_home_path();
  73  $iis7_permalinks     = iis7_supports_permalinks();
  74  $permalink_structure = get_option( 'permalink_structure' );
  75  
  76  $index_php_prefix = '';
  77  $blog_prefix      = '';
  78  
  79  if ( ! got_url_rewrite() ) {
  80      $index_php_prefix = '/index.php';
  81  }
  82  
  83  /*
  84   * In a subdirectory configuration of multisite, the `/blog` prefix is used by
  85   * default on the main site to avoid collisions with other sites created on that
  86   * network. If the `permalink_structure` option has been changed to remove this
  87   * base prefix, WordPress core can no longer account for the possible collision.
  88   */
  89  if ( is_multisite() && ! is_subdomain_install() && is_main_site()
  90      && str_starts_with( $permalink_structure, '/blog/' )
  91  ) {
  92      $blog_prefix = '/blog';
  93  }
  94  
  95  $category_base = get_option( 'category_base' );
  96  $tag_base      = get_option( 'tag_base' );
  97  
  98  $structure_updated        = false;
  99  $htaccess_update_required = false;
 100  
 101  if ( isset( $_POST['permalink_structure'] ) || isset( $_POST['category_base'] ) ) {
 102      check_admin_referer( 'update-permalink' );
 103  
 104      if ( isset( $_POST['permalink_structure'] ) ) {
 105          if ( isset( $_POST['selection'] ) && 'custom' !== $_POST['selection'] ) {
 106              $permalink_structure = $_POST['selection'];
 107          } else {
 108              $permalink_structure = $_POST['permalink_structure'];
 109          }
 110  
 111          if ( ! empty( $permalink_structure ) ) {
 112              $permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) );
 113  
 114              if ( $index_php_prefix && $blog_prefix ) {
 115                  $permalink_structure = $index_php_prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure );
 116              } else {
 117                  $permalink_structure = $blog_prefix . $permalink_structure;
 118              }
 119          }
 120  
 121          $permalink_structure = sanitize_option( 'permalink_structure', $permalink_structure );
 122  
 123          $wp_rewrite->set_permalink_structure( $permalink_structure );
 124  
 125          $structure_updated = true;
 126      }
 127  
 128      if ( isset( $_POST['category_base'] ) ) {
 129          $category_base = $_POST['category_base'];
 130  
 131          if ( ! empty( $category_base ) ) {
 132              $category_base = $blog_prefix . preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $category_base ) );
 133          }
 134  
 135          $wp_rewrite->set_category_base( $category_base );
 136      }
 137  
 138      if ( isset( $_POST['tag_base'] ) ) {
 139          $tag_base = $_POST['tag_base'];
 140  
 141          if ( ! empty( $tag_base ) ) {
 142              $tag_base = $blog_prefix . preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $tag_base ) );
 143          }
 144  
 145          $wp_rewrite->set_tag_base( $tag_base );
 146      }
 147  }
 148  
 149  if ( $iis7_permalinks ) {
 150      if ( ( ! file_exists( $home_path . 'web.config' )
 151          && win_is_writable( $home_path ) ) || win_is_writable( $home_path . 'web.config' )
 152      ) {
 153          $writable = true;
 154      } else {
 155          $writable = false;
 156      }
 157  } elseif ( $is_nginx || $is_caddy ) {
 158      $writable = false;
 159  } else {
 160      if ( ( ! file_exists( $home_path . '.htaccess' )
 161          && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' )
 162      ) {
 163          $writable = true;
 164      } else {
 165          $writable       = false;
 166          $existing_rules = array_filter( extract_from_markers( $home_path . '.htaccess', 'WordPress' ) );
 167          $new_rules      = array_filter( explode( "\n", $wp_rewrite->mod_rewrite_rules() ) );
 168  
 169          $htaccess_update_required = ( $new_rules !== $existing_rules );
 170      }
 171  }
 172  
 173  $using_index_permalinks = $wp_rewrite->using_index_permalinks();
 174  
 175  if ( $structure_updated ) {
 176      $message = __( 'Permalink structure updated.' );
 177  
 178      if ( ! is_multisite() && $permalink_structure && ! $using_index_permalinks ) {
 179          if ( $iis7_permalinks ) {
 180              if ( ! $writable ) {
 181                  $message = sprintf(
 182                      /* translators: %s: web.config */
 183                      __( 'You should update your %s file now.' ),
 184                      '<code>web.config</code>'
 185                  );
 186              } else {
 187                  $message = sprintf(
 188                      /* translators: %s: web.config */
 189                      __( 'Permalink structure updated. Remove write access on %s file now!' ),
 190                      '<code>web.config</code>'
 191                  );
 192              }
 193          } elseif ( ! $is_nginx && ! $is_caddy && $htaccess_update_required && ! $writable ) {
 194              $message = sprintf(
 195                  /* translators: %s: .htaccess */
 196                  __( 'You should update your %s file now.' ),
 197                  '<code>.htaccess</code>'
 198              );
 199          }
 200      }
 201  
 202      if ( ! get_settings_errors() ) {
 203          add_settings_error( 'general', 'settings_updated', $message, 'success' );
 204      }
 205  
 206      set_transient( 'settings_errors', get_settings_errors(), 30 ); // 30 seconds.
 207  
 208      wp_redirect( admin_url( 'options-permalink.php?settings-updated=true' ) );
 209      exit;
 210  }
 211  
 212  flush_rewrite_rules();
 213  
 214  require_once  ABSPATH . 'wp-admin/admin-header.php';
 215  ?>
 216  <div class="wrap">
 217  <h1><?php echo esc_html( $title ); ?></h1>
 218  
 219  <form name="form" action="options-permalink.php" method="post">
 220  <?php wp_nonce_field( 'update-permalink' ); ?>
 221  
 222  <p>
 223  <?php
 224  printf(
 225      /* translators: %s: Documentation URL. */
 226      __( 'WordPress offers you the ability to create a custom URL structure for your permalinks and archives. Custom URL structures can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="%s">number of tags are available</a>, and here are some examples to get you started.' ),
 227      __( 'https://wordpress.org/documentation/article/customize-permalinks/' )
 228  );
 229  ?>
 230  </p>
 231  
 232  <?php
 233  if ( is_multisite() && ! is_subdomain_install() && is_main_site()
 234      && str_starts_with( $permalink_structure, '/blog/' )
 235  ) {
 236      $permalink_structure = preg_replace( '|^/?blog|', '', $permalink_structure );
 237      $category_base       = preg_replace( '|^/?blog|', '', $category_base );
 238      $tag_base            = preg_replace( '|^/?blog|', '', $tag_base );
 239  }
 240  
 241  $url_base = home_url( $blog_prefix . $index_php_prefix );
 242  
 243  $default_structures = array(
 244      array(
 245          'id'      => 'plain',
 246          'label'   => __( 'Plain' ),
 247          'value'   => '',
 248          'example' => home_url( '/?p=123' ),
 249      ),
 250      array(
 251          'id'      => 'day-name',
 252          'label'   => __( 'Day and name' ),
 253          'value'   => $index_php_prefix . '/%year%/%monthnum%/%day%/%postname%/',
 254          'example' => $url_base . '/' . gmdate( 'Y/m/d' ) . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/',
 255      ),
 256      array(
 257          'id'      => 'month-name',
 258          'label'   => __( 'Month and name' ),
 259          'value'   => $index_php_prefix . '/%year%/%monthnum%/%postname%/',
 260          'example' => $url_base . '/' . gmdate( 'Y/m' ) . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/',
 261      ),
 262      array(
 263          'id'      => 'numeric',
 264          'label'   => __( 'Numeric' ),
 265          'value'   => $index_php_prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%',
 266          'example' => $url_base . '/' . _x( 'archives', 'sample permalink base' ) . '/123',
 267      ),
 268      array(
 269          'id'      => 'post-name',
 270          'label'   => __( 'Post name' ),
 271          'value'   => $index_php_prefix . '/%postname%/',
 272          'example' => $url_base . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/',
 273      ),
 274  );
 275  
 276  $default_structure_values = wp_list_pluck( $default_structures, 'value' );
 277  
 278  $available_tags = array(
 279      /* translators: %s: Permalink structure tag. */
 280      'year'     => __( '%s (The year of the post, four digits, for example 2004.)' ),
 281      /* translators: %s: Permalink structure tag. */
 282      'monthnum' => __( '%s (Month of the year, for example 05.)' ),
 283      /* translators: %s: Permalink structure tag. */
 284      'day'      => __( '%s (Day of the month, for example 28.)' ),
 285      /* translators: %s: Permalink structure tag. */
 286      'hour'     => __( '%s (Hour of the day, for example 15.)' ),
 287      /* translators: %s: Permalink structure tag. */
 288      'minute'   => __( '%s (Minute of the hour, for example 43.)' ),
 289      /* translators: %s: Permalink structure tag. */
 290      'second'   => __( '%s (Second of the minute, for example 33.)' ),
 291      /* translators: %s: Permalink structure tag. */
 292      'post_id'  => __( '%s (The unique ID of the post, for example 423.)' ),
 293      /* translators: %s: Permalink structure tag. */
 294      'postname' => __( '%s (The sanitized post title (slug).)' ),
 295      /* translators: %s: Permalink structure tag. */
 296      'category' => __( '%s (Category slug. Nested sub-categories appear as nested directories in the URL.)' ),
 297      /* translators: %s: Permalink structure tag. */
 298      'author'   => __( '%s (A sanitized version of the author name.)' ),
 299  );
 300  
 301  /**
 302   * Filters the list of available permalink structure tags on the Permalinks settings page.
 303   *
 304   * @since 4.9.0
 305   *
 306   * @param string[] $available_tags An array of key => value pairs of available permalink structure tags.
 307   */
 308  $available_tags = apply_filters( 'available_permalink_structure_tags', $available_tags );
 309  
 310  /* translators: %s: Permalink structure tag. */
 311  $tag_added = __( '%s added to permalink structure' );
 312  /* translators: %s: Permalink structure tag. */
 313  $tag_removed = __( '%s removed from permalink structure' );
 314  /* translators: %s: Permalink structure tag. */
 315  $tag_already_used = __( '%s (already used in permalink structure)' );
 316  ?>
 317  <h2 class="title"><?php _e( 'Common Settings' ); ?></h2>
 318  <p>
 319  <?php
 320  printf(
 321      /* translators: %s: %postname% */
 322      __( 'Select the permalink structure for your website. Including the %s tag makes links easy to understand, and can help your posts rank higher in search engines.' ),
 323      '<code>%postname%</code>'
 324  );
 325  ?>
 326  </p>
 327  <table class="form-table permalink-structure" role="presentation">
 328  <tbody>
 329  <tr>
 330      <th scope="row"><?php _e( 'Permalink structure' ); ?></th>
 331      <td>
 332          <fieldset class="structure-selection">
 333              <legend class="screen-reader-text">
 334                  <?php
 335                  /* translators: Hidden accessibility text. */
 336                  _e( 'Permalink structure' );
 337                  ?>
 338              </legend>
 339              <?php foreach ( $default_structures as $input ) : ?>
 340              <div class="row">
 341                  <input id="permalink-input-<?php echo esc_attr( $input['id'] ); ?>"
 342                      name="selection" aria-describedby="permalink-<?php echo esc_attr( $input['id'] ); ?>"
 343                      type="radio" value="<?php echo esc_attr( $input['value'] ); ?>"
 344                      <?php checked( $input['value'], $permalink_structure ); ?>
 345                  />
 346                  <div>
 347                      <label for="permalink-input-<?php echo esc_attr( $input['id'] ); ?>">
 348                          <?php echo esc_html( $input['label'] ); ?>
 349                      </label>
 350                      <p>
 351                          <code id="permalink-<?php echo esc_attr( $input['id'] ); ?>">
 352                              <?php echo esc_html( $input['example'] ); ?>
 353                          </code>
 354                      </p>
 355                  </div>
 356              </div><!-- .row -->
 357              <?php endforeach; ?>
 358  
 359              <div class="row">
 360                  <input id="custom_selection"
 361                      name="selection" type="radio" value="custom"
 362                      <?php checked( ! in_array( $permalink_structure, $default_structure_values, true ) ); ?>
 363                  />
 364                  <div>
 365                      <label for="custom_selection"><?php _e( 'Custom Structure' ); ?></label>
 366                      <p>
 367                          <label for="permalink_structure" class="screen-reader-text">
 368                              <?php
 369                              /* translators: Hidden accessibility text. */
 370                              _e( 'Customize permalink structure by selecting available tags' );
 371                              ?>
 372                          </label>
 373                          <span class="code">
 374                              <code id="permalink-custom"><?php echo esc_url( $url_base ); ?></code>
 375                              <input name="permalink_structure" id="permalink_structure"
 376                                  type="text" value="<?php echo esc_attr( $permalink_structure ); ?>"
 377                                  aria-describedby="permalink-custom" class="regular-text code"
 378                              />
 379                          </span>
 380                      </p>
 381  
 382                      <div class="available-structure-tags hide-if-no-js">
 383                          <div id="custom_selection_updated" aria-live="assertive" class="screen-reader-text"></div>
 384                          <?php if ( ! empty( $available_tags ) ) : ?>
 385                          <fieldset>
 386                              <legend><?php _e( 'Available tags:' ); ?></legend>
 387                              <ul role="list">
 388                              <?php foreach ( $available_tags as $tag => $explanation ) : ?>
 389                                  <li>
 390                                      <button type="button"
 391                                          class="button button-secondary"
 392                                          aria-label="<?php echo esc_attr( sprintf( $explanation, $tag ) ); ?>"
 393                                          data-added="<?php echo esc_attr( sprintf( $tag_added, $tag ) ); ?>"
 394                                          data-removed="<?php echo esc_attr( sprintf( $tag_removed, $tag ) ); ?>"
 395                                          data-used="<?php echo esc_attr( sprintf( $tag_already_used, $tag ) ); ?>">
 396                                          <?php echo '%' . esc_html( $tag ) . '%'; ?>
 397                                      </button>
 398                                  </li>
 399                              <?php endforeach; ?>
 400                              </ul>
 401                          </fieldset>
 402                          <?php endif; ?>
 403                      </div><!-- .available-structure-tags -->
 404                  </div>
 405              </div><!-- .row -->
 406          </fieldset><!-- .structure-selection -->
 407      </td>
 408  </tr>
 409  </tbody>
 410  </table>
 411  
 412  <h2 class="title"><?php _e( 'Optional' ); ?></h2>
 413  <p>
 414  <?php
 415  printf(
 416      /* translators: %s: Placeholder that must come at the start of the URL. */
 417      __( 'If you like, you may enter custom structures for your category and tag URLs here. For example, using <code>topics</code> as your category base would make your category links like <code>%s/topics/uncategorized/</code>. If you leave these blank the defaults will be used.' ),
 418      $url_base
 419  );
 420  ?>
 421  </p>
 422  
 423  <table class="form-table" role="presentation">
 424      <tr>
 425          <th>
 426              <label for="category_base">
 427                  <?php /* translators: Prefix for category permalinks. */ _e( 'Category base' ); ?>
 428              </label>
 429          </th>
 430          <td>
 431              <?php echo $blog_prefix; ?>
 432              <input name="category_base" id="category_base" type="text"
 433                  value="<?php echo esc_attr( $category_base ); ?>" class="regular-text code"
 434              />
 435          </td>
 436      </tr>
 437      <tr>
 438          <th>
 439              <label for="tag_base"><?php _e( 'Tag base' ); ?></label>
 440          </th>
 441          <td>
 442              <?php echo $blog_prefix; ?>
 443              <input name="tag_base" id="tag_base" type="text"
 444                  value="<?php echo esc_attr( $tag_base ); ?>" class="regular-text code"
 445              />
 446          </td>
 447      </tr>
 448      <?php do_settings_fields( 'permalink', 'optional' ); ?>
 449  </table>
 450  
 451  <?php do_settings_sections( 'permalink' ); ?>
 452  
 453  <?php submit_button(); ?>
 454  </form>
 455  
 456  <?php if ( ! is_multisite() ) : ?>
 457      <?php
 458      if ( $iis7_permalinks ) :
 459          if ( isset( $_POST['submit'] ) && $permalink_structure && ! $using_index_permalinks && ! $writable ) :
 460              if ( file_exists( $home_path . 'web.config' ) ) :
 461                  ?>
 462                  <p id="iis-description-a">
 463                  <?php
 464                  printf(
 465                      /* translators: 1: web.config, 2: Documentation URL, 3: Ctrl + A, 4: ⌘ + A, 5: Element code. */
 466                      __( '<strong>Error:</strong> Your %1$s file is not <a href="%2$s">writable</a>, so updating it automatically was not possible. This is the URL rewrite rule you should have in your %1$s file. Click in the field and press %3$s (or %4$s on Mac) to select all. Then insert this rule inside of the %5$s element in %1$s file.' ),
 467                      '<code>web.config</code>',
 468                      __( 'https://developer.wordpress.org/advanced-administration/server/file-permissions/' ),
 469                      '<kbd>Ctrl + A</kbd>',
 470                      '<kbd>⌘ + A</kbd>',
 471                      '<code>/&lt;configuration&gt;/&lt;system.webServer&gt;/&lt;rewrite&gt;/&lt;rules&gt;</code>'
 472                  );
 473                  ?>
 474                  </p>
 475                  <form action="options-permalink.php" method="post">
 476                      <?php wp_nonce_field( 'update-permalink' ); ?>
 477                      <p>
 478                          <label for="rules"><?php _e( 'Rewrite rules:' ); ?></label><br />
 479                          <textarea rows="9" class="large-text readonly"
 480                              name="rules" id="rules" readonly="readonly"
 481                              aria-describedby="iis-description-a"
 482                          ><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules() ); ?></textarea>
 483                      </p>
 484                  </form>
 485                  <p>
 486                  <?php
 487                  printf(
 488                      /* translators: %s: web.config */
 489                      __( 'If you temporarily make your %s file writable to generate rewrite rules automatically, do not forget to revert the permissions after the rule has been saved.' ),
 490                      '<code>web.config</code>'
 491                  );
 492                  ?>
 493                  </p>
 494              <?php else : ?>
 495                  <p id="iis-description-b">
 496                  <?php
 497                  printf(
 498                      /* translators: 1: Documentation URL, 2: web.config, 3: Ctrl + A, 4: ⌘ + A */
 499                      __( '<strong>Error:</strong> The root directory of your site is not <a href="%1$s">writable</a>, so creating a file automatically was not possible. This is the URL rewrite rule you should have in your %2$s file. Create a new file called %2$s in the root directory of your site. Click in the field and press %3$s (or %4$s on Mac) to select all. Then insert this code into the %2$s file.' ),
 500                      __( 'https://developer.wordpress.org/advanced-administration/server/file-permissions/' ),
 501                      '<code>web.config</code>',
 502                      '<kbd>Ctrl + A</kbd>',
 503                      '<kbd>⌘ + A</kbd>'
 504                  );
 505                  ?>
 506                  </p>
 507                  <form action="options-permalink.php" method="post">
 508                      <?php wp_nonce_field( 'update-permalink' ); ?>
 509                      <p>
 510                          <label for="rules"><?php _e( 'Rewrite rules:' ); ?></label><br />
 511                          <textarea rows="18" class="large-text readonly"
 512                              name="rules" id="rules" readonly="readonly"
 513                              aria-describedby="iis-description-b"
 514                          ><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules( true ) ); ?></textarea>
 515                      </p>
 516                  </form>
 517                  <p>
 518                  <?php
 519                  printf(
 520                      /* translators: %s: web.config */
 521                      __( 'If you temporarily make your site&#8217;s root directory writable to generate the %s file automatically, do not forget to revert the permissions after the file has been created.' ),
 522                      '<code>web.config</code>'
 523                  );
 524                  ?>
 525                  </p>
 526              <?php endif; // End if 'web.config' exists. ?>
 527          <?php endif; // End if $_POST['submit'] && ! $writable. ?>
 528      <?php else : ?>
 529          <?php if ( $permalink_structure && ! $using_index_permalinks && ! $writable && $htaccess_update_required ) : ?>
 530              <p id="htaccess-description">
 531              <?php
 532              printf(
 533                  /* translators: 1: .htaccess, 2: Documentation URL, 3: Ctrl + A, 4: ⌘ + A */
 534                  __( '<strong>Error:</strong> Your %1$s file is not <a href="%2$s">writable</a>, so updating it automatically was not possible. These are the mod_rewrite rules you should have in your %1$s file. Click in the field and press %3$s (or %4$s on Mac) to select all.' ),
 535                  '<code>.htaccess</code>',
 536                  __( 'https://developer.wordpress.org/advanced-administration/server/file-permissions/' ),
 537                  '<kbd>Ctrl + A</kbd>',
 538                  '<kbd>⌘ + A</kbd>'
 539              );
 540              ?>
 541              </p>
 542              <form action="options-permalink.php" method="post">
 543                  <?php wp_nonce_field( 'update-permalink' ); ?>
 544                  <p>
 545                      <label for="rules"><?php _e( 'Rewrite rules:' ); ?></label><br />
 546                      <textarea rows="8" class="large-text readonly"
 547                          name="rules" id="rules" readonly="readonly"
 548                          aria-describedby="htaccess-description"
 549                      ><?php echo esc_textarea( $wp_rewrite->mod_rewrite_rules() ); ?></textarea>
 550                  </p>
 551              </form>
 552          <?php endif; // End if ! $writable && $htaccess_update_required. ?>
 553      <?php endif; // End if $iis7_permalinks. ?>
 554  <?php endif; // End if ! is_multisite(). ?>
 555  
 556  </div><!-- .wrap -->
 557  
 558  <?php require_once  ABSPATH . 'wp-admin/admin-footer.php'; ?>


Generated : Tue Dec 24 08:20:01 2024 Cross-referenced by PHPXref