WordPress根据附件ID获取图像HTML元素函数:wp_get_attachment_image

WordPress函数wp_get_attachment_image可以根据附件ID获取该图像元素。 wp_get_attachment_image( int $attachment_id, …

WordPress删除附件函数:wp_delete_attachment

WordPress函数wp_delete_attachment用于删除指定ID的附件。 wp_delete_attachment( int $post_id, bool $force_delete = false ) 函数参数$post_id 整数 附件ID $force_delete 布尔值,默认值:false 是否跳过回收站 …

WordPress插入附件信息到数据库函数:wp_insert_attachment

WordPress函数wp_insert_attachment用于插入一个附件信息到数据库。 wp_insert_attachment( string|array $args, string|false $file = false, int $parent, bool $wp_error = false, bool $fire_after_hooks = true ) 函数参数$args 数组 该参数可用的值可以参考wp_i …

WordPress根据附件ID判断附件是否是图像函数:wp_attachment_is_image

WordPress函数wp_attachment_is_image根据附件的ID判断该附件是否是图像,如果想要通过文件路径来判断,则可以使用wp_check_filetype函数。 …

WordPress根据附件ID更新文件路径函数:update_attached_file

WordPress函数update_attached_file根据附件的ID更新文件路径。 update_attached_file( int $attachment_id, string $file ) 函数参数$ …

WordPress根据附件页面地址判断是否为本地附件:is_local_attachment

WordPress函数is_local_attachment根据附件页面URL判断该附件是否为本地附件,注意这里的URL是附件页面地址,而非附件文件URL。 is_local_attachment( string $url ) 函数参数$url …

WordPress判断是否附件页面函数:is_attachment

WordPress函数is_attachment用于判断当前页面是否为附件页。 is_attachment( int|string|int[]|string[] $attachment = '' ) 函数参数$attachment 字符串、整数或数组 附件的ID、别名或标题 函数使用示例if(i …

WordPress根据附件ID获取文件路径函数:get_attached_file

WordPress函数get_attached_file根据附件的ID返回对应附件的完整路径。 get_attached_file( int $attachment_id, bool $unfiltered = false ) 函数参数$attachment_id 整数 附件ID $unfiltered 布尔值,默认值:fa …

WordPress返回文章元数据值函数:get_post_custom_values

WordPress函数get_post_custom_values返回文章所有元数据的值。 get_post_custom_values( string $key = '', int $post_id ) 函数参数$key 字符串 自定义字段的键 $post_id 整数 文章的ID 函数返回值Array ( …

WordPress获取文章元数据键函数:get_post_custom_keys

WordPress函数get_post_custom_keys用于获取文章所有元数据的键。 get_post_custom_keys( int $post_id ) 函数参数$post_id 整数,默认值:当前文章ID 文章的ID 函数返回值文章的自定义 …