The image_link_input_fields() WordPress PHP function retrieves HTML for the Link URL buttons with the default link type specified.
Usage
image_link_input_fields($post, $url_type = '');
Custom Example:
// Input image_link_input_fields($post, 'file'); // Output // HTML for the Link URL buttons with the default link type set to 'file'.
Parameters
$post(WP_Post) – Required. The post object.$url_type(string) – Optional. The default link type. Default value: ” (empty string).
More information
See WordPress Developer Resources: image_link_input_fields
Examples
Display image link input fields with default URL type
function display_image_link_input_fields() {
global $post;
echo image_link_input_fields($post);
}
add_action('admin_footer', 'display_image_link_input_fields');
This code displays the image link input fields with the default URL type in the admin footer.
Display image link input fields with file URL type
function display_image_link_input_fields_file() {
global $post;
echo image_link_input_fields($post, 'file');
}
add_action('admin_footer', 'display_image_link_input_fields_file');
This code displays the image link input fields with the ‘file’ URL type in the admin footer.
Display image link input fields with post URL type
function display_image_link_input_fields_post() {
global $post;
echo image_link_input_fields($post, 'post');
}
add_action('admin_footer', 'display_image_link_input_fields_post');
This code displays the image link input fields with the ‘post’ URL type in the admin footer.
Display image link input fields with custom URL type
function display_image_link_input_fields_custom() {
global $post;
echo image_link_input_fields($post, 'custom');
}
add_action('admin_footer', 'display_image_link_input_fields_custom');
This code displays the image link input fields with the ‘custom’ URL type in the admin footer.
Display image link input fields with no URL type
function display_image_link_input_fields_no_url_type() {
global $post;
echo image_link_input_fields($post, '');
}
add_action('admin_footer', 'display_image_link_input_fields_no_url_type');
This code displays the image link input fields with no URL type in the admin footer.