The blog_privacy_selector WordPress PHP action enables the legacy ‘Site visibility’ privacy options and allows for customization of the site visibility settings.
Usage
add_action('blog_privacy_selector', 'your_custom_function'); function your_custom_function() { // your custom code here }
Parameters
- None
More information
See WordPress Developer Resources: blog_privacy_selector
Examples
Replacing the default checkbox with radio buttons
Add radio buttons to the site visibility options and remove the default checkbox.
add_action('blog_privacy_selector', 'replace_default_checkbox'); function replace_default_checkbox() { // Remove default checkbox remove_action('blog_privacy_selector', 'wp_discourage_search_engines'); // Add custom radio buttons // your custom code here }
Add a custom site visibility option
Add a custom radio button option to the site visibility settings.
add_action('blog_privacy_selector', 'add_custom_visibility_option'); function add_custom_visibility_option() { // Add custom radio button option // your custom code here }
Change the ‘Search engine visibility’ heading
Modify the ‘Search engine visibility’ heading to ‘Site visibility’.
add_action('blog_privacy_selector', 'change_heading'); function change_heading() { // Change the heading // your custom code here }
Hide site from specific search engines
Create an option to hide the site from specific search engines.
add_action('blog_privacy_selector', 'hide_from_specific_search_engines'); function hide_from_specific_search_engines() { // Add option to hide from specific search engines // your custom code here }
Disable the default ‘discourage search engines’ option
Remove the default ‘discourage search engines’ option from site visibility settings.
add_action('blog_privacy_selector', 'disable_discourage_search_engines'); function disable_discourage_search_engines() { // Remove the default option remove_action('blog_privacy_selector', 'wp_discourage_search_engines'); }