Switch language

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




metadata_exists [ WordPress Function ]

metadata_exists ( $meta_type, $object_id, $meta_key )
Parameters:
  • (string) $meta_type Type of object metadata is for (e.g., comment, post, or user)
  • (int) $object_id ID of the object metadata is for
  • (string) $meta_key Metadata key.
Returns:
  • (boolean) true of the key is set, false if not.
Defined at:



Determine if a meta key is set for a given object

Source


<?php
function metadata_exists$meta_type$object_id$meta_key ) {
    if ( ! 
$meta_type )
        return 
false;

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

    
$check apply_filters"get_{$meta_type}_metadata"null$object_id$meta_keytrue );
    if ( 
null !== $check )
        return 
true;

    
$meta_cache wp_cache_get$object_id$meta_type '_meta' );

    if ( !
$meta_cache ) {
        
$meta_cache update_meta_cache$meta_type, array( $object_id ) );
        
$meta_cache $meta_cache[$object_id];
    }

    if ( isset( 
$meta_cache$meta_key ] ) )
        return 
true;

    return 
false;
}
?>

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