Definition:
function get_attached_file( $attachment_id, $unfiltered = false ) {}
Parameters
- int $attachment_id: Attachment ID.
- bool $unfiltered: Whether to apply filters.
Return values
returns:The file path to the attached file.
Defined filters
- get_attached_file
apply_filters( 'get_attached_file', $file, $attachment_id )
Source code
function get_attached_file( $attachment_id, $unfiltered = false ) {
$file = get_post_meta( $attachment_id, '_wp_attached_file', true );
// If the file is relative, prepend upload dir
if ( 0 !== strpos($file, '/') && !preg_match('|^.:\\\|', $file) && ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) )
$file = $uploads['basedir'] . "/$file";
if ( $unfiltered )
return $file;
return apply_filters( 'get_attached_file', $file, $attachment_id );
}
1150

February 11, 2011 


get_approved_comments
Definition:
function get_approved_comments($post_id) {}
Parameters
Return values
returns:The approved comments
Source code
function get_approved_comments($post_id) { global $wpdb; return $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1' ORDER BY comment_date", $post_id)); }1142