WordPress.org

Make WordPress Core

Changeset 45219


Ignore:
Timestamp:
04/16/2019 08:29:42 PM (3 months ago)
Author:
adamsilverstein
Message:

Media: move get_available_post_mime_types to wp-includes/post.php making it more generally available.

Address an issue since r44947 where calling wp_enqueue_media on the front-end would result in a PHP fatal.

Props david.binda.
Fixes #46795.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/post.php

    r45083 r45219  
    11831183
    11841184    return $avail_post_stati;
    1185 }
    1186 
    1187 /**
    1188  * Get all available post MIME types for a given post type.
    1189  *
    1190  * @since 2.5.0
    1191  *
    1192  * @global wpdb $wpdb WordPress database abstraction object.
    1193  *
    1194  * @param string $type
    1195  * @return mixed
    1196  */
    1197 function get_available_post_mime_types( $type = 'attachment' ) {
    1198     global $wpdb;
    1199 
    1200     $types = $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT post_mime_type FROM $wpdb->posts WHERE post_type = %s", $type ) );
    1201     return $types;
    12021185}
    12031186
  • trunk/src/wp-includes/post.php

    r44785 r45219  
    68926892    wp_cache_set( 'last_changed', microtime(), 'posts' );
    68936893}
     6894
     6895/**
     6896 * Get all available post MIME types for a given post type.
     6897 *
     6898 * @since 2.5.0
     6899 *
     6900 * @global wpdb $wpdb WordPress database abstraction object.
     6901 *
     6902 * @param string $type
     6903 * @return mixed
     6904 */
     6905function get_available_post_mime_types( $type = 'attachment' ) {
     6906    global $wpdb;
     6907
     6908    $types = $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT post_mime_type FROM $wpdb->posts WHERE post_type = %s", $type ) );
     6909    return $types;
     6910}
Note: See TracChangeset for help on using the changeset viewer.