The post_trackback_meta_box WordPress PHP function displays trackback links form fields in the post editing screen.
Usage
To use the post_trackback_meta_box function, simply call it and pass the $post object as an argument:
$post = get_post(); post_trackback_meta_box($post);
Parameters
- $post (WP_Post) – The current post object, required for the function to display the trackback links form fields.
More information
See WordPress Developer Resources: post_trackback_meta_box
Examples
Adding Trackback Meta Box to a Custom Post Type
This example demonstrates how to add a trackback meta box to a custom post type called ‘my_custom_post_type’.
add_action('add_meta_boxes', 'add_trackback_meta_box_to_custom_post_type'); function add_trackback_meta_box_to_custom_post_type() { add_meta_box('trackbacksdiv', __('Trackbacks'), 'post_trackback_meta_box', 'my_custom_post_type', 'normal', 'low'); }
Displaying the Trackback Meta Box in a Custom Theme
To display the trackback meta box in a custom theme, add the following code to your theme’s single.php
or page.php
template file.
$post = get_post(); post_trackback_meta_box($post);
Displaying Trackback Meta Box on a Custom Admin Page
This example shows how to display the trackback meta box on a custom admin page.
function my_custom_admin_page() { $post = get_post(); post_trackback_meta_box($post); } add_action('admin_menu', 'my_custom_admin_page');
Customizing the Trackback Meta Box Title
To customize the title of the trackback meta box, you can modify the ‘add_meta_box’ function.
add_action('add_meta_boxes', 'add_custom_trackback_meta_box'); function add_custom_trackback_meta_box() { add_meta_box('trackbacksdiv', __('My Custom Trackbacks'), 'post_trackback_meta_box', 'post', 'normal', 'low'); }
Removing the Trackback Meta Box
To remove the trackback meta box from the post editing screen, use the ‘remove_meta_box’ function.
function remove_trackback_meta_box() { remove_meta_box('trackbacksdiv', 'post', 'normal'); } add_action('admin_menu', 'remove_trackback_meta_box');