WordPress.org

Forums

[resolved] prepend_attachment() does not handle all MIME types, e.g., "text" (2 posts)

  1. David Lingren
    Member
    Posted 1 year ago #

    Using version 3.9-beta3-27857

    In /wp-includes/post-template.php, function prepend_attachment() has been rewritten to prepend different content based on post_mime_type.

    Only image, audio and video MIME types are handled. Other MIME types, such as "text" and "application", fall out the bottom of the if/elseif tests and leave the $p variable undefined.

    This produces a PHP Notice: regarding the undefined variable.

    Perhaps adding a final else clause to show the icon for other MIME types would be useful

    else {
    		$p = '<p class="attachment">';
    		// show the medium sized image representation of the attachment if available, and link to the raw file
    		$p .= wp_get_attachment_link(0, 'medium', false, true );
    		$p .= '</p>';
    	}
  2. Hello David,

    thanks for the report. I have created a ticket for that: https://core.trac.wordpress.org/ticket/27634

Topic Closed

This topic has been closed to new replies.

About this Topic