• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_post_meta_by_id函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_post_meta_by_id函数的典型用法代码示例。如果您正苦于以下问题:PHP get_post_meta_by_id函数的具体用法?PHP get_post_meta_by_id怎么用?PHP get_post_meta_by_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_post_meta_by_id函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: save_meta

 static function save_meta($post_ID)
 {
     // Meta Stuff
     if (!isset($_POST['bbpmeta_no_js'])) {
         return;
     }
     if (isset($_POST['meta']) && $_POST['meta']) {
         foreach ($_POST['meta'] as $key => $value) {
             if (!($meta = get_post_meta_by_id($key))) {
                 continue;
             }
             if ($meta->post_id != $post_ID) {
                 continue;
             }
             if (!current_user_can('edit_post_meta', $post_ID, $value['key'])) {
                 continue;
             }
             update_meta($key, 'bbpmeta_params', $value);
         }
     }
     if (isset($_POST['deletemeta']) && $_POST['deletemeta']) {
         foreach ($_POST['deletemeta'] as $key => $value) {
             if (!($meta = get_post_meta_by_id($key))) {
                 continue;
             }
             if ($meta->post_id != $post_ID) {
                 continue;
             }
             if (!current_user_can('delete_post_meta', $post_ID, $meta->meta_key)) {
                 continue;
             }
             delete_meta($key);
         }
     }
     self::add_meta($post_ID);
 }
开发者ID:082net,项目名称:bbpresskr,代码行数:36,代码来源:meta.php


示例2: delete_post_meta

 function delete_post_meta($meta_id)
 {
     return;
     if (!isset($this->settings['translation-management']['custom_fields_translation'])) {
         return;
     }
     if (!function_exists('get_post_meta_by_id')) {
         require_once ABSPATH . 'wp-admin/includes/post.php';
     }
     if (is_array($meta_id)) {
         $meta_id = $meta_id[0];
     }
     $meta = get_post_meta_by_id($meta_id);
     if (!isset($this->settings['translation-management']['custom_fields_translation'][$meta->meta_key])) {
         return;
     }
     $custom_fields_translation_meta = $this->settings['translation-management']['custom_fields_translation'][$meta->meta_key];
     if ($meta && in_array($custom_fields_translation_meta, array(1, 2))) {
         $post = get_post($meta->post_id);
         $translated_docs = $this->get_translatable_documents();
         if (!empty($translated_docs[$post->post_type])) {
             $trid = $this->get_element_trid($meta->post_id, 'post_' . $post->post_type);
             if ($trid) {
                 $translations = $this->get_element_translations($trid, 'post_' . $post->post_type);
                 if ($translations) {
                     foreach ($translations as $t) {
                         if ($t->original) {
                             $original_id = $t->element_id;
                         }
                     }
                 }
                 if (isset($original_id)) {
                     if ($original_id == $meta->post_id) {
                         foreach ($translations as $t) {
                             if (!$t->original) {
                                 $this->_sync_custom_field($meta->post_id, $t->element_id, $meta->meta_key, $custom_fields_translation_meta == 1);
                             }
                         }
                     } else {
                         $this->_sync_custom_field($original_id, $meta->post_id, $meta->meta_key, $custom_fields_translation_meta == 1);
                     }
                 }
             }
         }
     }
 }
开发者ID:pablomarsan,项目名称:iftheme-docs,代码行数:46,代码来源:sitepress.class.php


示例3: test_get_post_meta_by_id

 function test_get_post_meta_by_id()
 {
     $mid = add_post_meta($this->post_id, 'get_post_meta_by_key', 'get_post_meta_by_key_value', true);
     $this->assertInternalType('integer', $mid);
     $mobj = new stdClass();
     $mobj->meta_id = $mid;
     $mobj->post_id = $this->post_id;
     $mobj->meta_key = 'get_post_meta_by_key';
     $mobj->meta_value = 'get_post_meta_by_key_value';
     $this->assertEquals($mobj, get_post_meta_by_id($mid));
     delete_metadata_by_mid('post', $mid);
     $mid = add_post_meta($this->post_id, 'get_post_meta_by_key', array('foo', 'bar'), true);
     $this->assertInternalType('integer', $mid);
     $mobj->meta_id = $mid;
     $mobj->meta_value = array('foo', 'bar');
     $this->assertEquals($mobj, get_post_meta_by_id($mid));
     delete_metadata_by_mid('post', $mid);
 }
开发者ID:boonebgorges,项目名称:wp,代码行数:18,代码来源:meta.php


示例4: edit_post


//.........这里部分代码省略.........
    $format_meta_urls = array('url', 'link_url', 'quote_source_url');
    foreach ($format_meta_urls as $format_meta_url) {
        $keyed = '_format_' . $format_meta_url;
        if (isset($post_data[$keyed])) {
            update_post_meta($post_ID, $keyed, wp_slash(esc_url_raw(wp_unslash($post_data[$keyed]))));
        }
    }
    $format_keys = array('quote', 'quote_source_name', 'image', 'gallery', 'audio_embed', 'video_embed');
    foreach ($format_keys as $key) {
        $keyed = '_format_' . $key;
        if (isset($post_data[$keyed])) {
            if (current_user_can('unfiltered_html')) {
                update_post_meta($post_ID, $keyed, $post_data[$keyed]);
            } else {
                update_post_meta($post_ID, $keyed, wp_filter_post_kses($post_data[$keyed]));
            }
        }
    }
    if ('attachment' === $post_data['post_type'] && preg_match('#^(audio|video)/#', $post_data['post_mime_type'])) {
        $id3data = wp_get_attachment_metadata($post_ID);
        if (!is_array($id3data)) {
            $id3data = array();
        }
        foreach (wp_get_attachment_id3_keys($post, 'edit') as $key => $label) {
            if (isset($post_data['id3_' . $key])) {
                $id3data[$key] = sanitize_text_field(wp_unslash($post_data['id3_' . $key]));
            }
        }
        wp_update_attachment_metadata($post_ID, $id3data);
    }
    // Meta Stuff
    if (isset($post_data['meta']) && $post_data['meta']) {
        foreach ($post_data['meta'] as $key => $value) {
            if (!($meta = get_post_meta_by_id($key))) {
                continue;
            }
            if ($meta->post_id != $post_ID) {
                continue;
            }
            if (is_protected_meta($value['key'], 'post') || !current_user_can('edit_post_meta', $post_ID, $value['key'])) {
                continue;
            }
            update_meta($key, $value['key'], $value['value']);
        }
    }
    if (isset($post_data['deletemeta']) && $post_data['deletemeta']) {
        foreach ($post_data['deletemeta'] as $key => $value) {
            if (!($meta = get_post_meta_by_id($key))) {
                continue;
            }
            if ($meta->post_id != $post_ID) {
                continue;
            }
            if (is_protected_meta($meta->meta_key, 'post') || !current_user_can('delete_post_meta', $post_ID, $meta->meta_key)) {
                continue;
            }
            delete_meta($key);
        }
    }
    // Attachment stuff
    if ('attachment' == $post_data['post_type']) {
        if (isset($post_data['_wp_attachment_image_alt'])) {
            $image_alt = wp_unslash($post_data['_wp_attachment_image_alt']);
            if ($image_alt != get_post_meta($post_ID, '_wp_attachment_image_alt', true)) {
                $image_alt = wp_strip_all_tags($image_alt, true);
                // update_meta expects slashed.
开发者ID:nicholasgriffintn,项目名称:WordPress,代码行数:67,代码来源:post.php


示例5: edit_post

/**
 * Update an existing post with values provided in $_POST.
 *
 * @since 1.5.0
 *
 * @param array $post_data Optional.
 * @return int Post ID.
 */
function edit_post($post_data = null)
{
    if (empty($post_data)) {
        $post_data =& $_POST;
    }
    // Clear out any data in internal vars.
    unset($post_data['filter']);
    $post_ID = (int) $post_data['post_ID'];
    $post = get_post($post_ID);
    $post_data['post_type'] = $post->post_type;
    $post_data['post_mime_type'] = $post->post_mime_type;
    $ptype = get_post_type_object($post_data['post_type']);
    if (!current_user_can('edit_post', $post_ID)) {
        if ('page' == $post_data['post_type']) {
            wp_die(__('You are not allowed to edit this page.'));
        } else {
            wp_die(__('You are not allowed to edit this post.'));
        }
    }
    $post_data = _wp_translate_postdata(true, $post_data);
    if (is_wp_error($post_data)) {
        wp_die($post_data->get_error_message());
    }
    if ((empty($post_data['action']) || 'autosave' != $post_data['action']) && 'auto-draft' == $post_data['post_status']) {
        $post_data['post_status'] = 'draft';
    }
    if (isset($post_data['visibility'])) {
        switch ($post_data['visibility']) {
            case 'public':
                $post_data['post_password'] = '';
                break;
            case 'password':
                unset($post_data['sticky']);
                break;
            case 'private':
                $post_data['post_status'] = 'private';
                $post_data['post_password'] = '';
                unset($post_data['sticky']);
                break;
        }
    }
    // Post Formats
    if (isset($post_data['post_format'])) {
        set_post_format($post_ID, $post_data['post_format']);
    }
    $format_meta_urls = array('url', 'link_url', 'quote_source_url');
    foreach ($format_meta_urls as $format_meta_url) {
        $keyed = '_format_' . $format_meta_url;
        if (isset($post_data[$keyed])) {
            update_post_meta($post_ID, $keyed, wp_slash(esc_url_raw(wp_unslash($post_data[$keyed]))));
        }
    }
    $format_keys = array('quote', 'quote_source_name', 'image', 'gallery', 'audio_embed', 'video_embed');
    foreach ($format_keys as $key) {
        $keyed = '_format_' . $key;
        if (isset($post_data[$keyed])) {
            if (current_user_can('unfiltered_html')) {
                update_post_meta($post_ID, $keyed, $post_data[$keyed]);
            } else {
                update_post_meta($post_ID, $keyed, wp_filter_post_kses($post_data[$keyed]));
            }
        }
    }
    // Meta Stuff
    if (isset($post_data['meta']) && $post_data['meta']) {
        foreach ($post_data['meta'] as $key => $value) {
            if (!($meta = get_post_meta_by_id($key))) {
                continue;
            }
            if ($meta->post_id != $post_ID) {
                continue;
            }
            if (is_protected_meta($value['key'], 'post') || !current_user_can('edit_post_meta', $post_ID, $value['key'])) {
                continue;
            }
            update_meta($key, $value['key'], $value['value']);
        }
    }
    if (isset($post_data['deletemeta']) && $post_data['deletemeta']) {
        foreach ($post_data['deletemeta'] as $key => $value) {
            if (!($meta = get_post_meta_by_id($key))) {
                continue;
            }
            if ($meta->post_id != $post_ID) {
                continue;
            }
            if (is_protected_meta($meta->meta_key, 'post') || !current_user_can('delete_post_meta', $post_ID, $meta->meta_key)) {
                continue;
            }
            delete_meta($key);
        }
    }
//.........这里部分代码省略.........
开发者ID:openify,项目名称:wordpress-composer,代码行数:101,代码来源:post.php


示例6: edit_post

/**
 * Update an existing post with values provided in $_POST.
 *
 * @since 1.5.0
 *
 * @param array $post_data Optional.
 * @return int Post ID.
 */
function edit_post($post_data = null)
{
    global $wpdb;
    if (empty($post_data)) {
        $post_data =& $_POST;
    }
    // Clear out any data in internal vars.
    unset($post_data['filter']);
    $post_ID = (int) $post_data['post_ID'];
    $post = get_post($post_ID);
    $post_data['post_type'] = $post->post_type;
    $post_data['post_mime_type'] = $post->post_mime_type;
    if (!empty($post_data['post_status'])) {
        $post_data['post_status'] = sanitize_key($post_data['post_status']);
        if ('inherit' == $post_data['post_status']) {
            unset($post_data['post_status']);
        }
    }
    $ptype = get_post_type_object($post_data['post_type']);
    if (!current_user_can('edit_post', $post_ID)) {
        if ('page' == $post_data['post_type']) {
            wp_die(__('You are not allowed to edit this page.'));
        } else {
            wp_die(__('You are not allowed to edit this post.'));
        }
    }
    if (post_type_supports($ptype->name, 'revisions')) {
        $revisions = wp_get_post_revisions($post_ID, array('order' => 'ASC', 'posts_per_page' => 1));
        $revision = current($revisions);
        // Check if the revisions have been upgraded
        if ($revisions && _wp_get_post_revision_version($revision) < 1) {
            _wp_upgrade_revisions_of_post($post, wp_get_post_revisions($post_ID));
        }
    }
    if (isset($post_data['visibility'])) {
        switch ($post_data['visibility']) {
            case 'public':
                $post_data['post_password'] = '';
                break;
            case 'password':
                unset($post_data['sticky']);
                break;
            case 'private':
                $post_data['post_status'] = 'private';
                $post_data['post_password'] = '';
                unset($post_data['sticky']);
                break;
        }
    }
    $post_data = _wp_translate_postdata(true, $post_data);
    if (is_wp_error($post_data)) {
        wp_die($post_data->get_error_message());
    }
    // Post Formats
    if (isset($post_data['post_format'])) {
        set_post_format($post_ID, $post_data['post_format']);
    }
    $format_meta_urls = array('url', 'link_url', 'quote_source_url');
    foreach ($format_meta_urls as $format_meta_url) {
        $keyed = '_format_' . $format_meta_url;
        if (isset($post_data[$keyed])) {
            update_post_meta($post_ID, $keyed, wp_slash(esc_url_raw(wp_unslash($post_data[$keyed]))));
        }
    }
    $format_keys = array('quote', 'quote_source_name', 'image', 'gallery', 'audio_embed', 'video_embed');
    foreach ($format_keys as $key) {
        $keyed = '_format_' . $key;
        if (isset($post_data[$keyed])) {
            if (current_user_can('unfiltered_html')) {
                update_post_meta($post_ID, $keyed, $post_data[$keyed]);
            } else {
                update_post_meta($post_ID, $keyed, wp_filter_post_kses($post_data[$keyed]));
            }
        }
    }
    if ('attachment' === $post_data['post_type'] && preg_match('#^(audio|video)/#', $post_data['post_mime_type'])) {
        $id3data = wp_get_attachment_metadata($post_ID);
        if (!is_array($id3data)) {
            $id3data = array();
        }
        foreach (wp_get_attachment_id3_keys($post, 'edit') as $key => $label) {
            if (isset($post_data['id3_' . $key])) {
                $id3data[$key] = sanitize_text_field(wp_unslash($post_data['id3_' . $key]));
            }
        }
        wp_update_attachment_metadata($post_ID, $id3data);
    }
    // Meta Stuff
    if (isset($post_data['meta']) && $post_data['meta']) {
        foreach ($post_data['meta'] as $key => $value) {
            if (!($meta = get_post_meta_by_id($key))) {
                continue;
//.........这里部分代码省略.........
开发者ID:GaryJones,项目名称:dockerfiles,代码行数:101,代码来源:post.php


示例7: delete_post_meta

 function delete_post_meta($meta_id)
 {
     static $_recur_control_flag = 0;
     // avoid recursion
     if ($_recur_control_flag) {
         return;
     }
     $_recur_control_flag = 1;
     // avoid recursion (dont return before $_recur_control_flag = 0;)
     if (!function_exists('get_post_meta_by_id')) {
         require_once ABSPATH . 'wp-admin/includes/post.php';
     }
     $meta = get_post_meta_by_id($meta_id);
     if ($meta) {
         if (isset($this->settings['translation-management']['custom_fields_translation'][$meta->meta_key]) && $this->settings['translation-management']['custom_fields_translation'][$meta->meta_key] == 1) {
             $post = get_post($meta->post_id);
             $translated_docs = $this->get_translatable_documents();
             if (!empty($translated_docs[$post->post_type])) {
                 $trid = $this->get_element_trid($meta->post_id, 'post_' . $post->post_type);
                 if ($trid) {
                     $translations = $this->get_element_translations($trid, 'post_' . $post->post_type);
                     foreach ($translations as $t) {
                         if ($t->original) {
                             $original_id = $t->element_id;
                         }
                     }
                     if ($original_id == $meta->post_id) {
                         foreach ($translations as $t) {
                             if (!$t->original) {
                                 delete_post_meta($t->element_id, $meta->meta_key);
                             }
                         }
                     }
                 }
             }
         }
     }
     $_recur_control_flag = 0;
 }
开发者ID:bidhanbaral,项目名称:fotodep_store,代码行数:39,代码来源:sitepress.class.php


示例8: die

             die('0');
         }
     } else {
         if (!($mid = add_meta($pid))) {
             die(__('Please provide a custom field value.'));
         }
     }
     $meta = get_post_meta_by_id($mid);
     $pid = (int) $meta->post_id;
     $meta = get_object_vars($meta);
     $x = new WP_Ajax_Response(array('what' => 'meta', 'id' => $mid, 'data' => _list_meta_row($meta, $c), 'position' => 1, 'supplemental' => array('postid' => $pid)));
 } else {
     $mid = (int) array_pop(array_keys($_POST['meta']));
     $key = $_POST['meta'][$mid]['key'];
     $value = $_POST['meta'][$mid]['value'];
     if (!($meta = get_post_meta_by_id($mid))) {
         die('0');
     }
     // if meta doesn't exist
     if (!current_user_can('edit_post', $meta->post_id)) {
         die('-1');
     }
     if ($meta->meta_value != stripslashes($value)) {
         if (!($u = update_meta($mid, $key, $value))) {
             die('0');
         }
         // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems).
     }
     $key = stripslashes($key);
     $value = stripslashes($value);
     $x = new WP_Ajax_Response(array('what' => 'meta', 'id' => $mid, 'old_id' => $mid, 'data' => _list_meta_row(array('meta_key' => $key, 'meta_value' => $value, 'meta_id' => $mid), $c), 'position' => 0, 'supplemental' => array('postid' => $meta->post_id)));
开发者ID:nagyist,项目名称:laura-wordpress,代码行数:31,代码来源:admin-ajax.php


示例9: edit_post

/**
 * Update an existing post with values provided in $_POST.
 *
 * @since 1.5.0
 *
 * @param array $post_data Optional.
 * @return int Post ID.
 */
function edit_post($post_data = null)
{
    if (empty($post_data)) {
        $post_data =& $_POST;
    }
    // Clear out any data in internal vars.
    unset($post_data['filter']);
    $post_ID = (int) $post_data['post_ID'];
    $post = get_post($post_ID);
    $post_data['post_type'] = $post->post_type;
    $post_data['post_mime_type'] = $post->post_mime_type;
    $ptype = get_post_type_object($post_data['post_type']);
    if (!current_user_can($ptype->cap->edit_post, $post_ID)) {
        if ('page' == $post_data['post_type']) {
            wp_die(__('You are not allowed to edit this page.'));
        } else {
            wp_die(__('You are not allowed to edit this post.'));
        }
    }
    // Autosave shouldn't save too soon after a real save
    if ('autosave' == $post_data['action']) {
        $post =& get_post($post_ID);
        $now = time();
        $then = strtotime($post->post_date_gmt . ' +0000');
        $delta = AUTOSAVE_INTERVAL / 2;
        if ($now - $then < $delta) {
            return $post_ID;
        }
    }
    $post_data = _wp_translate_postdata(true, $post_data);
    if (is_wp_error($post_data)) {
        wp_die($post_data->get_error_message());
    }
    if ('autosave' != $post_data['action'] && 'auto-draft' == $post_data['post_status']) {
        $post_data['post_status'] = 'draft';
    }
    if (isset($post_data['visibility'])) {
        switch ($post_data['visibility']) {
            case 'public':
                $post_data['post_password'] = '';
                break;
            case 'password':
                unset($post_data['sticky']);
                break;
            case 'private':
                $post_data['post_status'] = 'private';
                $post_data['post_password'] = '';
                unset($post_data['sticky']);
                break;
        }
    }
    // Post Formats
    if (isset($post_data['post_format'])) {
        if (current_theme_supports('post-formats', $post_data['post_format'])) {
            set_post_format($post_ID, $post_data['post_format']);
        } elseif ('0' == $post_data['post_format']) {
            set_post_format($post_ID, false);
        }
    }
    // Meta Stuff
    if (isset($post_data['meta']) && $post_data['meta']) {
        foreach ($post_data['meta'] as $key => $value) {
            if (!($meta = get_post_meta_by_id($key))) {
                continue;
            }
            if ($meta->post_id != $post_ID) {
                continue;
            }
            if (is_protected_meta($value['key'], 'post') || !current_user_can('edit_post_meta', $post_ID, $value['key'])) {
                continue;
            }
            update_meta($key, $value['key'], $value['value']);
        }
    }
    if (isset($post_data['deletemeta']) && $post_data['deletemeta']) {
        foreach ($post_data['deletemeta'] as $key => $value) {
            if (!($meta = get_post_meta_by_id($key))) {
                continue;
            }
            if ($meta->post_id != $post_ID) {
                continue;
            }
            if (is_protected_meta($meta->meta_key, 'post') || !current_user_can('delete_post_meta', $post_ID, $meta->meta_key)) {
                continue;
            }
            delete_meta($key);
        }
    }
    add_meta($post_ID);
    update_post_meta($post_ID, '_edit_last', $GLOBALS['current_user']->ID);
    wp_update_post($post_data);
    // Reunite any orphaned attachments with their parent
//.........这里部分代码省略.........
开发者ID:netconstructor,项目名称:WordPress,代码行数:101,代码来源:post.php


示例10: edit_post

/**
 * Update an existing post with values provided in $_POST.
 *
 * @since 1.5.0
 *
 * @param array $post_data Optional.
 * @return int Post ID.
 */
function edit_post($post_data = null)
{
    if (empty($post_data)) {
        $post_data =& $_POST;
    }
    // Clear out any data in internal vars.
    unset($post_data['filter']);
    $post_ID = (int) $post_data['post_ID'];
    $post = get_post($post_ID);
    $post_data['post_type'] = $post->post_type;
    $post_data['post_mime_type'] = $post->post_mime_type;
    $ptype = get_post_type_object($post_data['post_type']);
    if (!current_user_can($ptype->cap->edit_post, $post_ID)) {
        if ('page' == $post_data['post_type']) {
            wp_die(__('You are not allowed to edit this page.'));
        } else {
            wp_die(__('You are not allowed to edit this post.'));
        }
    }
    $post_data = _wp_translate_postdata(true, $post_data);
    if (is_wp_error($post_data)) {
        wp_die($post_data->get_error_message());
    }
    if ('autosave' != $post_data['action'] && 'auto-draft' == $post_data['post_status']) {
        $post_data['post_status'] = 'draft';
    }
    if (isset($post_data['visibility'])) {
        switch ($post_data['visibility']) {
            case 'public':
                $post_data['post_password'] = '';
                break;
            case 'password':
                unset($post_data['sticky']);
                break;
            case 'private':
                $post_data['post_status'] = 'private';
                $post_data['post_password'] = '';
                unset($post_data['sticky']);
                break;
        }
    }
    // Post Formats
    if (isset($post_data['post_format'])) {
        if (current_theme_supports('post-formats', $post_data['post_format'])) {
            set_post_format($post_ID, $post_data['post_format']);
        } elseif ('0' == $post_data['post_format']) {
            set_post_format($post_ID, false);
        }
    }
    // Featured Images
    if (isset($post_data['thumbnail_id'])) {
        if ('-1' == $post_data['thumbnail_id']) {
            delete_post_thumbnail($post_ID);
        } else {
            set_post_thumbnail($post_ID, $post_data['thumbnail_id']);
        }
    }
    // Meta Stuff
    if (isset($post_data['meta']) && $post_data['meta']) {
        foreach ($post_data['meta'] as $key => $value) {
            if (!($meta = get_post_meta_by_id($key))) {
                continue;
            }
            if ($meta->post_id != $post_ID) {
                continue;
            }
            if (is_protected_meta($value['key'], 'post') || !current_user_can('edit_post_meta', $post_ID, $value['key'])) {
                continue;
            }
            update_meta($key, $value['key'], $value['value']);
        }
    }
    if (isset($post_data['deletemeta']) && $post_data['deletemeta']) {
        foreach ($post_data['deletemeta'] as $key => $value) {
            if (!($meta = get_post_meta_by_id($key))) {
                continue;
            }
            if ($meta->post_id != $post_ID) {
                continue;
            }
            if (is_protected_meta($meta->meta_key, 'post') || !current_user_can('delete_post_meta', $post_ID, $meta->meta_key)) {
                continue;
            }
            delete_meta($key);
        }
    }
    // Attachment stuff
    if ('attachment' == $post_data['post_type'] && isset($post_data['_wp_attachment_image_alt'])) {
        $image_alt = get_post_meta($post_ID, '_wp_attachment_image_alt', true);
        if ($image_alt != stripslashes($post_data['_wp_attachment_image_alt'])) {
            $image_alt = wp_strip_all_tags(stripslashes($post_data['_wp_attachment_image_alt']), true);
            // update_meta expects slashed
//.........这里部分代码省略.........
开发者ID:rkglug,项目名称:WordPress,代码行数:101,代码来源:post.php



注:本文中的get_post_meta_by_id函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_post_mime_type函数代码示例发布时间:2022-05-15
下一篇:
PHP get_post_meta函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap