Action hook 'blog_privacy_selector'

in WP Core File wp-admin/options-reading.php at line 240

View Source

blog_privacy_selector

Action Hook
Description
Enables the legacy 'Site visibility' privacy options. By default the privacy options form displays a single checkbox to 'discourage' search engines from indexing the site. Hooking to this action serves a dual purpose: 1. Disable the single checkbox in favor of a multiple-choice list of radio buttons. 2. Open the door to adding additional radio button choices to the list. Hooking to this action also converts the 'Search engine visibility' heading to the more open-ended 'Site visibility' heading.

Hook Information

File Location wp-admin/options-reading.php View on GitHub
Hook Type Action
Line Number 240

Hook Parameters

This hook doesn't accept any parameters.

Usage Examples

Basic Usage
<?php
// Hook into blog_privacy_selector
add_action('blog_privacy_selector', 'my_custom_function');

function my_custom_function() {
    // Your custom code here
}

Source Code Context

wp-admin/options-reading.php:240 - How this hook is used in WordPress core
<?php
 235  	 * Hooking to this action also converts the 'Search engine visibility' heading to the more
 236  	 * open-ended 'Site visibility' heading.
 237  	 *
 238  	 * @since 2.1.0
 239  	 */
 240  	do_action( 'blog_privacy_selector' );
 241  	?>
 242  <?php else : ?>
 243  	<label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" value="0" <?php checked( '0', get_option( 'blog_public' ) ); ?> />
 244  	<?php _e( 'Discourage search engines from indexing this site' ); ?></label>
 245  	<p class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p>

PHP Documentation

<?php
/**
	 * Enables the legacy 'Site visibility' privacy options.
	 *
	 * By default the privacy options form displays a single checkbox to 'discourage' search
	 * engines from indexing the site. Hooking to this action serves a dual purpose:
	 *
	 * 1. Disable the single checkbox in favor of a multiple-choice list of radio buttons.
	 * 2. Open the door to adding additional radio button choices to the list.
	 *
	 * Hooking to this action also converts the 'Search engine visibility' heading to the more
	 * open-ended 'Site visibility' heading.
	 *
	 * @since 2.1.0
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 0
  • File: wp-admin/options-reading.php
Related Hooks

Related hooks will be displayed here in future updates.