Switch language

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




add_meta [ WordPress Function ]

add_meta ( $post_ID )
Parameters:
  • (unknown_type) $post_ID
Returns:
  • (unknown)
Defined at:



{@internal Missing Short Description}}

Source


<?php
function add_meta$post_ID ) {
    global 
$wpdb;
    
$post_ID = (int) $post_ID;

    
$metakeyselect = isset($_POST['metakeyselect']) ? stripslashestrim$_POST['metakeyselect'] ) ) : '';
    
$metakeyinput = isset($_POST['metakeyinput']) ? stripslashestrim$_POST['metakeyinput'] ) ) : '';
    
$metavalue = isset($_POST['metavalue']) ? $_POST['metavalue'] : '';
    if ( 
is_string$metavalue ) )
        
$metavalue trim$metavalue );

    if ( (
'0' === $metavalue || ! empty ( $metavalue ) ) && ( ( ( '#NONE#' != $metakeyselect ) && !empty ( $metakeyselect) ) || !empty ( $metakeyinput ) ) ) {
        
// We have a key/value pair. If both the select and the
        // input for the key have data, the input takes precedence:

         
if ( '#NONE#' != $metakeyselect )
            
$metakey $metakeyselect;

        if ( 
$metakeyinput )
            
$metakey $metakeyinput// default

        
if ( is_protected_meta$metakey'post' ) || ! current_user_can'add_post_meta'$post_ID$metakey ) )
            return 
false;

        
$metakey esc_sql$metakey );

        return 
add_post_meta$post_ID$metakey$metavalue );
    }

    return 
false;
// add_meta
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



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