使用指定的默认链接类型检索“链接URL”按钮的HTML。

原型

image_link_input_fields( WP_Post $post, string $url_type = '' )

参数

$post (WP_Post) (Required)

$url_type (string) (Optional)

返回值

(string)  

源文件

路径:wp-admin/includes/media.php

<?php
...
function image_link_input_fields($post, $url_type = '') {
	$file = wp_get_attachment_url($post->ID);
	$link = get_attachment_link($post->ID);
	if ( empty($url_type) )
		$url_type = get_user_setting('urlbutton', 'post');
	$url = '';
	if ( $url_type == 'file' )
		$url = $file;
	elseif ( $url_type == 'post' )
		$url = $link;
	return "
	<input type='text' class='text urlfield' name='attachments[$post->ID][url]' value='" . esc_attr($url) . "' /><br />
	<button type='button' class='button urlnone' data-link-url=''>" . __('None') . "</button>
	<button type='button' class='button urlfile' data-link-url='" . esc_attr($file) . "'>" . __('File URL') . "</button>
	<button type='button' class='button urlpost' data-link-url='" . esc_attr($link) . "'>" . __('Attachment Post URL') . "</button>
";
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/image_link_input_fields/