How to Customize Excerpts for Password...
Optimize your WordPress site! This snippet customizes excerpts for password-protected...

WPCodeBox
684
This snippet helps remind you to publish your site and ensure search engine visibility after going live, crucial for SEO.
<?php
/**
* Check if Website is visible to Search Engines
*/
function wpse_check_visibility() {
if ( ! class_exists( 'WPSEO_Admin' ) ) {
if ( '0' == get_option( 'blog_public' ) ) {
add_action( 'admin_footer', 'wpse_private_wp_warning' );
}
}
}
add_action( 'admin_init', 'wpse_check_visibility' );
/**
* If website is Private, show alert
*/
function wpse_private_wp_warning() {
if ( ( function_exists( 'is_network_admin' ) && is_network_admin() ) ) {
return;
}
echo '<div id=""robotsmessage"" class=""error"">';
echo '<p><strong>' . __( "Huge SEO Issue: You're blocking access to robots.", 'wpse-seo' ) . '</strong> ' . sprintf( __( 'You must %sgo to your Reading Settings%s and uncheck the box for Search Engine Visibility.', 'wordpress-seo' ), '<a href=""' . esc_url( admin_url( 'options-reading.php' ) ) . '"">', '</a>' ) . '</p></div>';
}





