WordPress is_trackback() Function

Beginner
4 min read
Updated: Nov 2026
3 examples
Conditional tag

Definition

In WordPress, is_trackback() returns true when the request is a trackback. A trackback is an old way for one blog to tell another that it linked to a post.

Trackbacks are rare today and many sites turn them off. You will mostly see this tag in older themes and plugins.

Syntax

Use it as the test of an if statement.

WordPress
if ( is_trackback() ) {
  // code for the true path
} else {
  // code for the false path
}
CallWhat it does
is_trackback()True if the request is a trackback.
! is_trackback()True for a normal request.
is_feed()Another request type check, for feeds.

You can switch trackbacks off in Settings > Discussion.

Full declaration
WordPress
is_trackback(): bool

Parameters

ParameterDescription
NoneThis function takes no parameters.

Return Value

Return ValueDescription
booltrue if the request is a trackback, otherwise false.

WordPress Examples

Three short theme examples. Each one shows what prints on the true path and the false path.

Example 1 — Detect a trackback

Print a note when a trackback arrives.

WordPress
<?php if ( is_trackback() ) {
  echo 'This is a trackback request.';
} ?>

How It Works

  1. is_trackback() checks the request type.
  2. It is true only for trackbacks.
  3. Normal visitors never run the code.

Example 2 — Skip the page for trackbacks

Do not print the full page for a trackback.

WordPress
<?php if ( ! is_trackback() ) {
  get_template_part( 'template-parts/header-menu' );
} ?>

How It Works

  1. ! is_trackback() means a normal request.
  2. The menu is printed only for normal pages.
  3. Trackbacks get a small response.

Example 3 — Different request types

Print a label for feeds and trackbacks.

WordPress
<?php
if ( is_trackback() ) {
  echo 'trackback';
} elseif ( is_feed() ) {
  echo 'feed';
} else {
  echo 'page';
} ?>

How It Works

  1. Each test checks one request type.
  2. elseif runs only when earlier tests are false.
  3. The else branch is the normal page.

Frequently Asked Questions

It returns true or false (a bool). Use it inside an if statement.
It is a message one blog sends to another to say it linked to one of its posts.
Only if your theme or plugin needs to handle old trackback requests.
Go to Settings > Discussion and clear the option about link notifications.
Conditional tags need the main query. Call them in template files or on hooks such as wp or template_redirect, not directly at the top of functions.php.

Next: is_user_logged_in()

Check if the visitor is logged in.

is_user_logged_in() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

11 people found this page helpful