Switch language

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




get_metadata_by_mid [ WordPress Function ]

get_metadata_by_mid ( $meta_type, $meta_id )
Parameters:
  • (string) $meta_type Type of object metadata is for (e.g., comment, post, or user)
  • (int) $meta_id ID for a specific meta row
Returns:
  • (object) Meta object or false.
Defined at:



Get meta data by meta ID

Source


<?php
function get_metadata_by_mid$meta_type$meta_id ) {
    global 
$wpdb;

    if ( ! 
$meta_type )
        return 
false;

    if ( !
$meta_id absint$meta_id ) )
        return 
false;

    if ( ! 
$table _get_meta_table($meta_type) )
        return 
false;

    
$id_column = ( 'user' == $meta_type ) ? 'umeta_id' 'meta_id';

    
$meta $wpdb->get_row$wpdb->prepare"SELECT * FROM $table WHERE $id_column = %d"$meta_id ) );

    if ( empty( 
$meta ) )
        return 
false;

    if ( isset( 
$meta->meta_value ) )
        
$meta->meta_value maybe_unserialize$meta->meta_value );

    return 
$meta;
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



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