-
Notifications
You must be signed in to change notification settings - Fork 0
/
search-engines-blocked-in-header.php
37 lines (34 loc) · 1.23 KB
/
search-engines-blocked-in-header.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/*
Plugin Name: Search Engines Blocked in Header
Plugin URI: https://wpcorner.co/plugins
Description: Display the 'Search Engines Discouraged' (or any translation) notification in the WordPress Toolbar if blog_public option has been checked.
Author: WP Corner
Version: 1.0.0
Author URI: https://wpcorner.co
Text Domain: search-engines-blocked-in-header
Domain Path: /languages/
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
add_action( 'admin_bar_menu', 'nostromo_search_engines_blocked', 1000 );
function nostromo_search_engines_blocked() {
global $wp_admin_bar, $wpdb;
if ( ! is_super_admin() || ! is_admin_bar_showing() ) {
return;
}
$url = '/wp-admin/options-reading.php';
if ( ! get_option( 'blog_public' ) ) {
$wp_admin_bar->add_menu( array( 'id' => 'search_engines_blocked',
'title' => __( 'Search Engines Discouraged', 'search-engines-blocked-in-header' ),
'href' => $url
) );
}
}
/* Load Text Domain */
add_action( 'plugins_loaded', 'sebih_load_textdomain' );
function sebih_load_textdomain() {
load_plugin_textdomain( 'search-engines-blocked-in-header', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
}
?>