Title: wp_maybe_disable_trackback_for_environment
Published: August 20, 2026

---

# wp_maybe_disable_trackback_for_environment()

## In this article

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

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

Rejects incoming trackbacks in non-production environments.

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

Hooked to `pre_trackback_post` which fires in `wp-trackback.php` before the trackback
is processed. Calls `trackback_response()` which sends an XML error response and
terminates the request.

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

    ```php
    function wp_maybe_disable_trackback_for_environment() {
    	if ( wp_should_disable_pings_for_environment() ) {
    		trackback_response( 1, __( 'Trackbacks are disabled in non-production environments.' ) );
    	}
    }
    ```

[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#L3481)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/comment.php#L3481-L3485)

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

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

Determines whether pings should be disabled for the current environment.

  | 
| [trackback_response()](https://developer.wordpress.org/reference/functions/trackback_response/)`wp-trackback.php` |

Response to a trackback.

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

Retrieves the translation of $text.

  |

[Show 1 more](https://developer.wordpress.org/reference/functions/wp_maybe_disable_trackback_for_environment/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/wp_maybe_disable_trackback_for_environment/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_maybe_disable_trackback_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_maybe_disable_trackback_for_environment%2F)
before being able to contribute a note or feedback.