Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




update_attached_file [ WordPress Function ]

update_attached_file ( $attachment_id, $file )
Parameters:
  • (int) $attachment_id Attachment ID
  • (string) $file File path for the attachment
Uses:
Returns:
  • (bool) False on failure, true on success.
Defined at:



Update attachment file path based on attachment ID.

Used to update the file path of the attachment, which uses post meta name '_wp_attached_file' to store the path of the attachment.

Source


<?php
function update_attached_file$attachment_id$file ) {
    if ( !
get_post$attachment_id ) )
        return 
false;

    
$file apply_filters'update_attached_file'$file$attachment_id );
    
$file _wp_relative_upload_path($file);

    return 
update_post_meta$attachment_id'_wp_attached_file'$file );
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics