Use wp_robots_no_robots filter if required
This commit is contained in:
parent
997cf0ac9d
commit
d598514a3f
@ -315,7 +315,7 @@ Fictioneer customizes WordPress by using as many standard action and filter hook
|
||||
| `wp_handle_upload_prefilter` | `fictioneer_upload_restrictions`
|
||||
| `wp_insert_post_data` | `fictioneer_remove_restricted_block_content`, `fictioneer_strip_shortcodes_on_save`, `fictioneer_see_some_evil`, `fictioneer_enforce_permalink`, `fictioneer_prevent_publish_date_update`, `fictioneer_prevent_parent_and_order_update`, `fictioneer_prevent_track_and_ping_updates`
|
||||
| `wp_is_application_passwords_available` | `__return_false`
|
||||
| `wp_robots` | `fictioneer_add_noindex_to_robots`
|
||||
| `wp_robots` | `wp_robots_no_robots`
|
||||
| `wp_sitemaps_enabled` | `__return_false`
|
||||
| `wp_unique_post_slug` | `fictioneer_protect_reserved_post_slugs`
|
||||
|
||||
|
@ -40,6 +40,11 @@ if ( is_archive() || is_search() || is_404() || FICTIONEER_MU_REGISTRATION ) {
|
||||
$post_id = null;
|
||||
}
|
||||
|
||||
// Prevent indexing if required
|
||||
if ( ( $args['no_index'] ?? 0 ) || FICTIONEER_MU_REGISTRATION ) {
|
||||
add_filter( 'wp_robots', 'wp_robots_no_robots' );
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!doctype html>
|
||||
@ -51,10 +56,6 @@ if ( is_archive() || is_search() || is_404() || FICTIONEER_MU_REGISTRATION ) {
|
||||
// Includes charset, content type, viewport, etc...
|
||||
fictioneer_output_head_meta();
|
||||
|
||||
// Prevent indexing if required
|
||||
if ( ( $args['no_index'] ?? 0 ) || FICTIONEER_MU_REGISTRATION ) {
|
||||
add_filter( 'wp_robots', 'fictioneer_add_noindex_to_robots' );
|
||||
}
|
||||
|
||||
// WordPress <head> hook
|
||||
wp_head();
|
||||
|
@ -1367,23 +1367,6 @@ if ( ! function_exists( 'fictioneer_output_head_fonts' ) ) {
|
||||
add_action( 'wp_head', 'fictioneer_output_head_fonts', 5 );
|
||||
add_action( 'admin_head', 'fictioneer_output_head_fonts', 5 );
|
||||
|
||||
// =============================================================================
|
||||
// MODIFY ROBOTS META
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* Adds noindex to robots meta.
|
||||
*
|
||||
* This is called in the header.php template.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*/
|
||||
|
||||
function fictioneer_add_noindex_to_robots( $robots ) {
|
||||
$robots['noindex'] = true;
|
||||
return $robots;
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// OUTPUT HEAD CRITICAL SCRIPTS
|
||||
// =============================================================================
|
||||
|
Loading…
x
Reference in New Issue
Block a user