get_trackback_url() WordPress Function

The get_trackback_url() function retrieves the URL for a post's trackback. This can be useful for displaying a link to allow other websites to send trackbacks to your post.

get_trackback_url() #

Retrieves the current post’s trackback URL.


Description

There is a check to see if permalink’s have been enabled and if so, will retrieve the pretty path. If permalinks weren’t enabled, the ID of the current post is used and appended to the correct page to go to.


Top ↑

Return

(string) The trackback URL after being filtered.


Top ↑

Source

File: wp-includes/comment-template.php

function get_trackback_url() {
	if ( get_option( 'permalink_structure' ) ) {
		$tb_url = trailingslashit( get_permalink() ) . user_trailingslashit( 'trackback', 'single_trackback' );
	} else {
		$tb_url = get_option( 'siteurl' ) . '/wp-trackback.php?p=' . get_the_ID();
	}

	/**
	 * Filters the returned trackback URL.
	 *
	 * @since 2.2.0
	 *
	 * @param string $tb_url The trackback URL.
	 */
	return apply_filters( 'trackback_url', $tb_url );
}


Top ↑

Changelog

Changelog
VersionDescription
1.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More