Skip to content

Commit

Permalink
add a new function for the message
Browse files Browse the repository at this point in the history
the message applies the filter so the individual calls don't need to do a check
  • Loading branch information
jazzsequence committed Jul 19, 2024
1 parent cb4e5b1 commit 8079e33
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions inc/network/includes-network.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,22 @@ function get_clean_basedomain() {
return $domain;
}

/**
* Returns the warning message about subdirectory multisites not liking custom wp-content directories.
*
* Applies the 'pantheon.subdirectory_networks_message' filter.
*
* @since 1.4.4
* @return string Warning message or empty string.
*/
function pantheon_get_subdirectory_networks_message() {
if ( apply_filters( 'pantheon.enable_subdirectory_networks_message', true ) ) {
return '<p><strong>' . __( 'Warning:' ) . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
}

return '';
}

/**
* Prints step 1 for Network installation process.
*
Expand Down Expand Up @@ -231,7 +247,7 @@ function network_step1( $errors = false ) {
endif;

if ( WP_CONTENT_DIR !== ABSPATH . 'wp-content' && ( allow_subdirectory_install() || ! allow_subdomain_install() ) ) {
echo '<div class="error inline"><p><strong>' . esc_html__( 'Warning:' ) . '</strong> ' . esc_html__( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>';
echo esc_html( pantheon_get_subdirectory_networks_message() );
}

$is_www = ( 0 === strpos( $hostname, 'www.' ) );
Expand Down Expand Up @@ -595,7 +611,8 @@ function network_step2( $errors = false ) {
);
echo '</p>';
if ( ! $subdomain_install && WP_CONTENT_DIR !== ABSPATH . 'wp-content' ) {
echo '<p><strong>' . esc_html__( 'Warning:' ) . ' ' . esc_html__( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
// Display the subdirectory networks message unless filtered.
echo esc_html( pantheon_get_subdirectory_networks_message() );
}
?>
<p class="configuration-rules-label"><label for="network-webconfig-rules">
Expand Down Expand Up @@ -657,7 +674,8 @@ function network_step2( $errors = false ) {
);
echo '</p>';
if ( ! $subdomain_install && WP_CONTENT_DIR !== ABSPATH . 'wp-content' ) {
echo '<p><strong>' . esc_html__( 'Warning:' ) . ' ' . esc_html__( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
// Display the subdirectory networks message unless filtered.
echo esc_html( pantheon_get_subdirectory_networks_message() );
}
?>
<p class="configuration-rules-label"><label for="network-htaccess-rules">
Expand Down

0 comments on commit 8079e33

Please # to comment.