Title: wp_should_disable_pings_for_environment
Published: August 20, 2026

---

# wp_should_disable_pings_for_environment(): bool

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_should_disable_pings_for_environment/?output_format=md#description)
 * [Return](https://developer.wordpress.org/reference/functions/wp_should_disable_pings_for_environment/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_should_disable_pings_for_environment/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/wp_should_disable_pings_for_environment/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/wp_should_disable_pings_for_environment/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_should_disable_pings_for_environment/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_should_disable_pings_for_environment/?output_format=md#wp--skip-link--target)

Determines whether pings should be disabled for the current environment.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_should_disable_pings_for_environment/?output_format=md#description)󠁿

By default, all pings (outgoing pingbacks, trackbacks, and ping service notifications,
as well as incoming pingbacks and trackbacks) are disabled for non-production environments(‘
local’, ‘development’, ‘staging’).

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_should_disable_pings_for_environment/?output_format=md#return)󠁿

 bool True if pings should be disabled, false otherwise.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_should_disable_pings_for_environment/?output_format=md#source)󠁿

    ```php
    function wp_should_disable_pings_for_environment() {
    	$environment_type = wp_get_environment_type();
    	$should_disable   = 'production' !== $environment_type;

    	/**
    	 * Filters whether pings should be disabled for the current environment.
    	 *
    	 * Returning false re-enables pings in non-production environments.
    	 * Returning true disables pings even in production.
    	 *
    	 * @since 7.1.0
    	 *
    	 * @param bool   $should_disable  Whether pings should be disabled. Default true
    	 *                                for non-production environments, false for production.
    	 * @param string $environment_type The current environment type as returned by
    	 *                                 wp_get_environment_type().
    	 */
    	return apply_filters( 'wp_should_disable_pings_for_environment', $should_disable, $environment_type );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/comment.php#L3436)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/comment.php#L3436-L3454)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/wp_should_disable_pings_for_environment/?output_format=md#hooks)󠁿

 [apply_filters( ‘wp_should_disable_pings_for_environment’, bool $should_disable, string $environment_type )](https://developer.wordpress.org/reference/hooks/wp_should_disable_pings_for_environment/)

Filters whether pings should be disabled for the current environment.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_should_disable_pings_for_environment/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_get_environment_type()](https://developer.wordpress.org/reference/functions/wp_get_environment_type/)`wp-includes/load.php` |

Retrieves the current environment type.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

| Used by | Description | 
| [wp_maybe_disable_trackback_for_environment()](https://developer.wordpress.org/reference/functions/wp_maybe_disable_trackback_for_environment/)`wp-includes/comment.php` |

Rejects incoming trackbacks in non-production environments.

  | 
| [wp_maybe_disable_xmlrpc_pingback_for_environment()](https://developer.wordpress.org/reference/functions/wp_maybe_disable_xmlrpc_pingback_for_environment/)`wp-includes/comment.php` |

Removes the pingback XML-RPC method in non-production environments.

  | 
| [wp_maybe_disable_outgoing_pings_for_environment()](https://developer.wordpress.org/reference/functions/wp_maybe_disable_outgoing_pings_for_environment/)`wp-includes/comment.php` |

Removes outgoing ping callbacks in non-production environments.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_should_disable_pings_for_environment/?output_format=md#changelog)󠁿

| Version | Description | 
| [7.1.0](https://developer.wordpress.org/reference/since/7.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_should_disable_pings_for_environment%2F)
before being able to contribute a note or feedback.