Action hook 'pre_trackback_post'

in WP Core File wp-trackback.php at line 118

View Source

pre_trackback_post

Action Hook
Description
Fires before the trackback is added to a post.

Hook Information

File Location wp-trackback.php View on GitHub
Hook Type Action
Line Number 118

Hook Parameters

Type Name Description
int $post_id Post ID related to the trackback.
string $trackback_url Trackback URL.
string $charset Character set.
string $title Trackback title.
string $excerpt Trackback excerpt.
string $blog_name Site name.

Usage Examples

Basic Usage
<?php
// Hook into pre_trackback_post
add_action('pre_trackback_post', 'my_custom_function', 10, 6);

function my_custom_function($post_id, $trackback_url, $charset, $title, $excerpt, $blog_name) {
    // Your custom code here
}

Source Code Context

wp-trackback.php:118 - How this hook is used in WordPress core
<?php
 113  	 * @param string $charset       Character set.
 114  	 * @param string $title         Trackback title.
 115  	 * @param string $excerpt       Trackback excerpt.
 116  	 * @param string $blog_name     Site name.
 117  	 */
 118  	do_action( 'pre_trackback_post', $post_id, $trackback_url, $charset, $title, $excerpt, $blog_name );
 119  
 120  	header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ) );
 121  
 122  	if ( ! pings_open( $post_id ) ) {
 123  		trackback_response( 1, __( 'Sorry, trackbacks are closed for this item.' ) );

PHP Documentation

<?php
/**
	 * Fires before the trackback is added to a post.
	 *
	 * @since 4.7.0
	 *
	 * @param int    $post_id       Post ID related to the trackback.
	 * @param string $trackback_url Trackback URL.
	 * @param string $charset       Character set.
	 * @param string $title         Trackback title.
	 * @param string $excerpt       Trackback excerpt.
	 * @param string $blog_name     Site name.
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 6
  • File: wp-trackback.php
Related Hooks

Related hooks will be displayed here in future updates.