Network-Wide Footer Notice
Lets super admins set one line of text in Network Admin > Settings, such as a hosting credit or legal link, that appears in the footer of every site.
Opens WPIDE on
Code
if ( ! is_multisite() ) {
return;
}
add_action( 'wpmu_options', function () {
?>
<h2><?php esc_html_e( 'Footer notice' ); ?></h2>
<table class="form-table" role="presentation">
<tr>
<th scope="row"><label for="wpide_network_footer"><?php esc_html_e( 'Text' ); ?></label></th>
<td><input type="text" name="wpide_network_footer" id="wpide_network_footer" class="large-text" value="<?php echo esc_attr( get_site_option( 'wpide_network_footer', '' ) ); ?>">
<p class="description"><?php esc_html_e( 'Links are allowed.' ); ?></p></td>
</tr>
</table>
<?php
} );
add_action( 'update_wpmu_options', function () {
if ( isset( $_POST['wpide_network_footer'] ) && current_user_can( 'manage_network_options' ) ) {
update_site_option( 'wpide_network_footer', wp_kses( wp_unslash( $_POST['wpide_network_footer'] ), array( 'a' => array( 'href' => true, 'rel' => true, 'target' => true ), 'strong' => array(), 'em' => array() ) ) );
}
} );
add_action( 'wp_footer', function () {
$text = get_site_option( 'wpide_network_footer', '' );
if ( '' !== trim( $text ) ) {
echo '<div class="wpide-network-footer" style="text-align:center;font-size:13px;padding:12px 16px;opacity:.8">' . wp_kses_post( $text ) . '</div>';
}
} );
Notes
Leave the field empty to hide it. Styled lightly so it fits most themes; adjust the inline CSS to match yours.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.