本文整理汇总了PHP中get_post_type_object函数的典型用法代码示例。如果您正苦于以下问题:PHP get_post_type_object函数的具体用法?PHP get_post_type_object怎么用?PHP get_post_type_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_post_type_object函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: ctc_after_save_event
/**
* After Save Event
*
* This runs after the event post is saved, for further manipulation of meta data.
*
* @since 1.2
* @param int $post_id Post ID
* @param object $post Data for post being saved
*/
function ctc_after_save_event($post_id, $post)
{
// Event is being saved
if (!isset($post->post_type) || 'ctc_event' != $post->post_type) {
return;
}
// Is a POST occurring?
if (empty($_POST)) {
return;
}
// Not an auto-save (meta values not submitted)
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
}
// Verify the nonce
$nonce_key = 'ctc_event_date_nonce';
$nonce_action = 'ctc_event_date_save';
if (empty($_POST[$nonce_key]) || !wp_verify_nonce($_POST[$nonce_key], $nonce_action)) {
return;
}
// Make sure user has permission to edit
$post_type = get_post_type_object($post->post_type);
if (!current_user_can($post_type->cap->edit_post, $post_id)) {
return;
}
// Action hook
do_action('ctc_after_save_event', $post_id, $post);
}
开发者ID:faithmade,项目名称:churchthemes,代码行数:37,代码来源:admin-event-fields.php
示例2: flt_adjust_reqd_caps
function flt_adjust_reqd_caps($reqd_caps, $orig_cap, $user_id, $args)
{
global $pagenow, $current_user;
// Work around WP's occasional use of literal 'cap_name' instead of $post_type_object->cap->$cap_name
// note: cap names for "post" type may be customized too
if (in_array($pagenow, array('edit.php', 'post.php', 'post-new.php', 'press-this.php', 'admin-ajax.php', 'upload.php', 'media.php')) && in_array('edit_posts', $reqd_caps) && $user_id == $current_user->ID && !$this->doing_admin_menus()) {
static $did_admin_init = false;
if (!$did_admin_init) {
$did_admin_init = did_action('admin_init');
}
if ($did_admin_init) {
if (!empty($args[0])) {
$item_id = is_object($args[0]) ? $args[0]->ID : $args[0];
} else {
$item_id = 0;
}
if ($type_obj = get_post_type_object(pp_find_post_type($item_id))) {
$key = array_search('edit_posts', $reqd_caps);
if (false !== $key) {
$reqd_caps[$key] = $type_obj->cap->edit_posts;
}
}
}
}
//===============================
return $reqd_caps;
}
开发者ID:estrategasdigitales,项目名称:glummer,代码行数:27,代码来源:cap-interceptor-admin_pp.php
示例3: bu_navigation_filter_pages_ancestors
/**
* Appends an "active_section" property to every post being returned during bu_navigation_get_pages
*
* @param array $pages Associative array of pages keyed on page ID
* @return array Filtered associative array of pages with active_section member variable set
*/
function bu_navigation_filter_pages_ancestors($pages)
{
global $wpdb, $post;
// Only useful during single post query
if (!$post) {
return $pages;
}
// Only needed for hierarchical post types
$post_type_object = get_post_type_object($post->post_type);
if (!$post_type_object->hierarchical) {
return $pages;
}
$ancestors = bu_navigation_gather_sections($post->ID, array('post_types' => $post->post_type));
$filtered = array();
if (is_array($pages) && count($pages) > 0) {
if (is_array($ancestors) && count($ancestors) > 0) {
foreach ($pages as $page) {
$page->active_section = false;
if (in_array($page->ID, $ancestors) && $page->ID != $post->ID) {
$page->active_section = true;
}
$filtered[$page->ID] = $page;
}
} else {
$filtered = $pages;
}
}
return $filtered;
}
开发者ID:iamapioneer,项目名称:sdas,代码行数:35,代码来源:bu-navigation-ancestors.php
示例4: savemeta
public static function savemeta($post_id, $post)
{
/* Get the post type object. */
$post_type = get_post_type_object($post->post_type);
/* Check if the current user has permission to edit the post. */
if (!current_user_can($post_type->cap->edit_post, $post_id)) {
return $post_id;
}
/* Get the meta key. */
$meta_key = self::$prefix . $post_id;
/* Get the posted data and sanitize it for use as an HTML class. */
$new_meta_value = isset($_POST[self::$prefix]) ? $_POST[self::$prefix] : '';
/* Get the meta value of the custom field key. */
$meta_value = get_post_meta($post_id, $meta_key, true);
/* If a new meta value was added and there was no previous value, add it. */
if ($new_meta_value && '' == $meta_value) {
add_post_meta($post_id, $meta_key, $new_meta_value, true);
} elseif ($new_meta_value && $new_meta_value != $meta_value) {
update_post_meta($post_id, $meta_key, $new_meta_value);
} elseif ('' == $new_meta_value && $meta_value) {
delete_post_meta($post_id, $meta_key, $meta_value);
if (($ptemplate = self::getPathTheme($post_id)) && file_exists($ptemplate)) {
unlink($ptemplate);
}
}
}
开发者ID:taeche,项目名称:SoDoEx,代码行数:26,代码来源:jv_header.php
示例5: query_posts
public static function query_posts($request = null)
{
$response = (object) array('status' => false, 'message' => __('Your request has failed', 'fakerpress'), 'results' => array(), 'more' => true);
if (!Admin::$is_ajax && is_null($request) || !is_user_logged_in()) {
return Admin::$is_ajax ? exit(json_encode($response)) : $response;
}
$request = (object) $_POST;
if (isset($request->query['post_type']) && !is_array($request->query['post_type'])) {
$request->query['post_type'] = array_map('trim', (array) explode(',', $request->query['post_type']));
}
$query = new \WP_Query($request->query);
if (!$query->have_posts()) {
return Admin::$is_ajax ? exit(json_encode($response)) : $response;
}
$response->status = true;
$response->message = __('Request successful', 'fakerpress');
foreach ($query->posts as $k => $post) {
$query->posts[$k]->post_type = get_post_type_object($post->post_type);
}
$response->results = $query->posts;
if ($query->max_num_pages >= $request->query['paged']) {
$response->more = false;
}
return Admin::$is_ajax ? exit(json_encode($response)) : $response;
}
开发者ID:samuelleal,项目名称:jardimdigital,代码行数:25,代码来源:class-fp-ajax.php
示例6: flt_get_editable_authors
function flt_get_editable_authors($unfiltered_results)
{
global $wpdb, $scoper, $post;
if (!($post_type = cr_find_post_type())) {
return $unfiltered_results;
}
if (!($post_type_obj = get_post_type_object($post_type))) {
return $unfiltered_results;
}
$have_cap = cr_user_can($post_type_obj->cap->edit_others_posts, $post->ID, 0, array('require_full_object_role' => true));
if ($have_cap) {
return $scoper->users_who_can($post_type_obj->cap->edit_posts, COLS_ALL_RS);
} else {
if ($post->ID) {
if ($current_author = $scoper->data_sources->get_from_db('owner', 'post', $post->ID)) {
$force_user_id = $current_author;
}
} else {
global $current_user;
$force_user_id = $current_user->ID;
}
if ($force_user_id) {
$display_name = $wpdb->get_var("SELECT display_name FROM {$wpdb->users} WHERE ID = '{$force_user_id}'");
$users = array((object) array('ID' => $force_user_id, 'display_name' => $display_name));
return $users;
}
}
//log_mem_usage_rs( 'flt_get_editable_authors()' );
return $unfiltered_results;
}
开发者ID:Netsoro,项目名称:gdnlteamgroup,代码行数:30,代码来源:hardway-users_rs.php
示例7: medium_save_video_meta
/**
* Saves the video embed code on post save
*
* @since 4.0
*/
function medium_save_video_meta($post_id)
{
global $post;
// Return early if this is a newly created post that hasn't been saved yet.
if ('auto-draft' == get_post_status($post_id)) {
return $post_id;
}
// Check if the user intended to change this value.
if (!isset($_POST['medium_video_box_nonce']) || !wp_verify_nonce($_POST['medium_video_box_nonce'], plugin_basename(__FILE__))) {
return $post_id;
}
// Get post type object
$post_type = get_post_type_object($post->post_type);
// Check if user has permission
if (!current_user_can($post_type->cap->edit_post, $post_id)) {
return $post_id;
}
// Get posted data and sanitize it
$new_video = isset($_POST['medium_video_field']) ? $_POST['medium_video_field'] : '';
// Get existing video
$video = get_post_meta($post_id, 'video', true);
// If a new video was submitted and there was no previous one, add it
if ($new_video && '' == $video) {
add_post_meta($post_id, 'video', $new_video, true);
} elseif ($new_video && $new_video != $video) {
update_post_meta($post_id, 'video', $new_video);
} elseif ('' == $new_video && $video) {
delete_post_meta($post_id, 'video', $video);
}
}
开发者ID:newscloud,项目名称:medium,代码行数:35,代码来源:metabox.php
示例8: popmake_render_popup_columns
/**
* Render Popup Columns
*
* @since 1.0
*
* @param string $column_name Column name
* @param int $post_id Popup (Post) ID
*
* @return void
*/
function popmake_render_popup_columns($column_name, $post_id)
{
if (get_post_type($post_id) == 'popup') {
global $popmake_options;
$post = get_post($post_id);
setup_postdata($post);
$post_type_object = get_post_type_object($post->post_type);
$can_edit_post = current_user_can($post_type_object->cap->edit_post, $post->ID);
switch ($column_name) {
case 'popup_title':
echo '<strong>' . esc_html(popmake_get_the_popup_title($post_id)) . '</strong>';
break;
case 'popup_category':
echo get_the_term_list($post_id, 'popup_category', '', ', ', '');
break;
case 'popup_tag':
echo get_the_term_list($post_id, 'popup_tag', '', ', ', '');
break;
case 'class':
echo '<pre style="display:inline-block;margin:0;"><code>popmake-' . absint($post_id) . '</code></pre>';
if ($post->post_name != $post->ID) {
echo '|';
echo '<pre style="display:inline-block;margin:0;"><code>popmake-' . $post->post_name . '</code></pre>';
}
break;
}
}
}
开发者ID:weerapat,项目名称:wp-daily,代码行数:38,代码来源:dashboard-columns.php
示例9: my_init
function my_init()
{
$args = objectToArray(get_post_type_object('post'));
$args['has_archive'] = 'news';
$args['rewrite'] = array('slug' => 'news', 'with_front' => false);
register_post_type('post', $args);
}
开发者ID:nicovicz,项目名称:wptv,代码行数:7,代码来源:functions.php
示例10: bogo_post_row_actions
function bogo_post_row_actions($actions, $post)
{
if (!bogo_is_localizable_post_type($post->post_type)) {
return $actions;
}
$post_type_object = get_post_type_object($post->post_type);
if (!current_user_can($post_type_object->cap->edit_post, $post->ID) || 'trash' == $post->post_status) {
return $actions;
}
$user_locale = bogo_get_user_locale();
$post_locale = bogo_get_post_locale($post->ID);
if ($user_locale == $post_locale) {
return $actions;
}
$translations = bogo_get_post_translations($post);
if (!empty($translations[$user_locale])) {
$translation = $translations[$user_locale];
if (empty($translation->ID) || $translation->ID == $post->ID) {
return $actions;
}
$title = __('Edit %s translation of this item', 'bogo');
$text = __('Edit %s translation', 'bogo');
$edit_link = get_edit_post_link($translation->ID);
} else {
$title = __('Translate this item into %s', 'bogo');
$text = __('Translate into %s', 'bogo');
$edit_link = admin_url('post-new.php?post_type=' . $post->post_type . '&locale=' . $user_locale . '&original_post=' . $post->ID);
}
$language = bogo_get_language($user_locale);
if (empty($language)) {
$language = $user_locale;
}
$actions['translate'] = '<a title="' . esc_attr(sprintf($title, $language)) . '" href="' . $edit_link . '">' . esc_html(sprintf($text, $language)) . '</a>';
return $actions;
}
开发者ID:karthikakamalanathan,项目名称:wp-cookieLawInfo,代码行数:35,代码来源:post.php
示例11: clone_landing_page
/**
* Creates cloned landing page and opens it for user
* @param string $status
*/
public static function clone_landing_page($status = 'pending')
{
/* Get the original post */
$id = isset($_GET['post']) ? $_GET['post'] : $_POST['post'];
$post = get_post($id);
/* Copy the post and insert it */
if (!isset($post) || !$post) {
$post_type_obj = get_post_type_object($post->post_type);
wp_die(esc_attr(__('Copy creation failed, could not find original:', 'landing-pages')) . ' ' . $id);
}
if (!is_object($post) && is_numeric($post)) {
$post = get_post($post);
}
$status = $post->post_status;
/* We don't want to clone revisions */
if ($post->post_type == 'revision') {
return;
}
$prefix = "Copy of ";
$suffix = "";
$status = 'pending';
$new_post_author = self::get_current_user();
$new_post = array('menu_order' => $post->menu_order, 'comment_status' => $post->comment_status, 'ping_status' => $post->ping_status, 'post_author' => $new_post_author->ID, 'post_content' => $post->post_content, 'post_excerpt' => $post->post_excerpt, 'post_mime_type' => $post->post_mime_type, 'post_parent' => $new_post_parent = empty($parent_id) ? $post->post_parent : $parent_id, 'post_password' => $post->post_password, 'post_status' => $status, 'post_title' => $prefix . $post->post_title . $suffix, 'post_type' => $post->post_type);
$new_post['post_date'] = $new_post_date = $post->post_date;
$new_post['post_date_gmt'] = get_gmt_from_date($new_post_date);
$new_post_id = wp_insert_post($new_post);
$meta_data = self::get_meta($post->ID);
foreach ($meta_data as $key => $value) {
update_post_meta($new_post_id, $key, $value);
}
wp_redirect(admin_url('edit.php?post_type=' . $post->post_type));
exit;
}
开发者ID:gbaladi,项目名称:landing-pages,代码行数:37,代码来源:class.cloning.php
示例12: normalize
/**
* Normalize parameters for field
*
* @param array $field
*
* @return array
*/
static function normalize($field)
{
/**
* Set default field args
*/
$field = wp_parse_args($field, array('post_type' => 'post', 'field_type' => 'select', 'parent' => false, 'query_args' => array()));
/**
* Set default placeholder
* - If multiple post types: show 'Select a post'
* - If single post type: show 'Select a %post_type_name%'
*/
if (empty($field['placeholder'])) {
$field['placeholder'] = __('Select a post', 'meta-box');
if (is_string($field['post_type']) && post_type_exists($field['post_type'])) {
$post_type_object = get_post_type_object($field['post_type']);
$field['placeholder'] = sprintf(__('Select a %s', 'meta-box'), $post_type_object->labels->singular_name);
}
}
/**
* Set parent option, which will change field name to `parent_id` to save as post parent
*/
if ($field['parent']) {
$field['multiple'] = false;
$field['field_name'] = 'parent_id';
}
/**
* Set default query args
*/
$field['query_args'] = wp_parse_args($field['query_args'], array('post_status' => 'publish', 'posts_per_page' => -1));
$field['query_args']['post_type'] = $field['post_type'];
$field = parent::normalize($field);
return $field;
}
开发者ID:ahmadawais,项目名称:meta-box,代码行数:40,代码来源:post.php
示例13: flt_defeat_publish_filter
function flt_defeat_publish_filter($where)
{
$post_type = cr_find_post_type();
$post_type_obj = get_post_type_object($post_type);
$object_id = scoper_get_object_id('post', $post_type);
// don't alter the query if RS query filtering is disabled, or if this maneuver has been disabled via constant
// note: for non-administrators, QueryInterceptor_RS::flt_objects_where will convert the publish requirement to publish OR private, if the user's blog role or RS-assigned roles grant private access
if (!is_content_administrator_rs() || defined('SCOPER_RETAIN_PUBLISH_FILTER') || defined('DISABLE_QUERYFILTERS_RS')) {
return $where;
}
global $wp_query;
if (is_admin() && !empty($wp_query->query['post_status'])) {
// if a specific status was requested by URI, don't force inclusion of others
return $where;
}
// don't alter the where clause if in wp-admin and not filtering by taxonomy
if (is_admin()) {
global $wp_query;
if (empty($wp_query) && empty($wp_query->is_tax)) {
return $where;
}
}
global $wpdb, $current_user;
// don't alter the where clause for anonymous users
if (empty($current_user->ID)) {
return $where;
}
$where = preg_replace("/{$wpdb->posts}.post_status\\s*=\\s*'publish'/", "({$wpdb->posts}.post_status = 'publish' OR {$wpdb->posts}.post_status = 'private')", $where);
$where = preg_replace("/p2.post_status\\s*=\\s*'publish'/", "(p2.post_status = 'publish' OR p2.post_status = 'private')", $where);
$where = preg_replace("/p.post_status\\s*=\\s*'publish'/", "(p.post_status = 'publish' OR p.post_status = 'private')", $where);
return $where;
}
开发者ID:btj,项目名称:cscircles-wp-content,代码行数:32,代码来源:query-interceptor-base_rs.php
示例14: copernico_save_seo_post_meta
/**
* SAVE metaboxes for SEO
*/
function copernico_save_seo_post_meta($post_id, $post)
{
/*
* Security checks
*/
if (!isset($_POST['copernico_metabox_nonce']) || !wp_verify_nonce($_POST['copernico_metabox_nonce'], basename(__FILE__))) {
return $post_id;
}
/*
* Check current user permissions
*/
$post_type = get_post_type_object($post->post_type);
if (!current_user_can($post_type->cap->edit_post, $post_id)) {
return $post_id;
}
/*
* Do not save the data if autosave
*/
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return $post_id;
}
if ($post->post_type == 'post') {
update_post_meta($post_id, 'copernico_seo_title', trim($_POST['copernico_seo_title']));
//update_post_meta($post_id, 'rudr_noindex', $_POST['rudr_noindex']);
}
return $post_id;
}
开发者ID:miniMAC,项目名称:copernico,代码行数:30,代码来源:metaboxes.php
示例15: __construct
/**
* TODO: Ability to set default values for:
*
* - Campaign type
* - List, list segment
* - Template
*/
public function __construct($post_type = null)
{
$this->post_type = $post_type;
$this->post_type_obj = get_post_type_object($this->post_type);
$this->settings_key = $this->post_type_obj->name . '_mailchimp_settings';
$this->init();
}
开发者ID:INN,项目名称:wordpress-mailchimp-tools,代码行数:14,代码来源:class-mailchimp-post-type-settings.php
示例16: themeist_plugins_save_plugin_info_meta_box
/**
* Saves the plugin info meta box.
*
* @since 0.1.0
*/
function themeist_plugins_save_plugin_info_meta_box($post_id, $post)
{
if (!isset($_POST['themeist-plugin-info-meta-box']) || !wp_verify_nonce($_POST['themeist-plugin-info-meta-box'], basename(__FILE__))) {
return $post_id;
}
$post_type = get_post_type_object($post->post_type);
if (!current_user_can($post_type->cap->edit_post, $post_id)) {
return $post_id;
}
$meta = array('plugin_download_url' => esc_attr(strip_tags($_POST['plugin-download-link'])), 'plugin_repo_url' => esc_url(strip_tags($_POST['plugin-repo-link'])), 'plugin_version_number' => strip_tags($_POST['plugin-version']));
foreach ($meta as $meta_key => $new_meta_value) {
/* Get the meta value of the custom field key. */
$meta_value = get_post_meta($post_id, $meta_key, true);
/* If a new meta value was added and there was no previous value, add it. */
if (!empty($new_meta_value) && empty($meta_value)) {
add_post_meta($post_id, $meta_key, $new_meta_value, true);
} elseif ($new_meta_value !== $meta_value) {
update_post_meta($post_id, $meta_key, $new_meta_value);
} elseif ('' === $new_meta_value && !empty($meta_value)) {
delete_post_meta($post_id, $meta_key, $meta_value);
}
}
/* We need this b/c draft post's post_name don't get set. */
$post_name = !empty($post->post_name) ? $post->post_name : sanitize_title($post->post_title);
if (!term_exists("relationship-{$post_name}", 'doc_relationship')) {
$args = array('slug' => "relationship-{$post_name}");
$parent_term = get_term_by('slug', 'relationship-plugins', 'doc_relationship');
if (!empty($parent_term)) {
$args['parent'] = $parent_term->term_id;
}
wp_insert_term($post->post_title, 'doc_relationship', $args);
}
}
开发者ID:hchouhan,项目名称:glossary-by-themeist,代码行数:38,代码来源:meta-boxes.php
示例17: title_toggle_post_title_actions
/**
* Add a checkbox to the post actions metabox
*
* @since 1.0.0
*/
function title_toggle_post_title_actions()
{
global $post;
$post_type = get_post_type_object($post->post_type);
$hide_title = get_post_meta($post->ID, '_hide_title', true);
?>
<div class="misc-pub-section columns-prefs">
<?php
wp_nonce_field('title_toggle_post_title', 'title_toggle_post_title_nonce');
?>
<label class="columns-prefs-1">
<?php
printf(__('Hide %s title:', 'title-toggle'), strtolower($post_type->labels->singular_name));
?>
<input type="checkbox" name="hide_title" value="1" <?php
checked($hide_title, '1');
?>
>
</label>
</div>
<?php
}
开发者ID:helgatheviking,项目名称:Title-Toggle,代码行数:30,代码来源:title-toggle.php
示例18: republish_link
function republish_link()
{
global $post;
$post_type_object = get_post_type_object($post->post_type);
$can_publish = current_user_can($post_type_object->cap->publish_posts);
if (!($can_publish && 'publish' == $post->post_status)) {
return;
}
print <<<SCRIPT
<script>
jQuery(document).ready( function(\$) {
\$('.cancel-timestamp').after('<a href="#republish" class="republish hide-if-no-js button-cancel">Set publish date to now</a>');
\$('.republish').click( function( event ) {
\$('#aa').val(\$('#cur_aa').val());
\$('#mm').val(\$('#cur_mm').val());
\$('#jj').val(\$('#cur_jj').val());
\$('#hh').val(\$('#cur_hh').val());
\$('#mn').val(\$('#cur_mn').val());
\t \$('.save-timestamp').click();
\t pub = \$('#timestamp').find('b').html();
\t pub = pub.replace(' : ',':');
\t pub = pub.replace('@ ','@');
\t if(\$.isNumeric(pub.charAt(0))) pub = pub.substring(3)
\t \$('#timestamp').find('b').html(pub);
});
});
</script>
SCRIPT;
}
开发者ID:jonpetersen,项目名称:PHTC,代码行数:29,代码来源:class-post-admin.php
示例19: kkthemes_archive_title
function kkthemes_archive_title()
{
$tag_style = '';
$header_image = get_header_image();
if (!empty($header_image)) {
$tag_style = 'background-image: url(' . esc_url($header_image) . ');';
}
?>
<div class="uk-panel uk-panel-box uk-panel-space uk-text-large uk-text-center tm-branded-panel uk-margin-large-bottom" style="<?php
echo $tag_style;
?>
">
<h1 class="uk-article-title" itemprop="headline">
<?php
single_cat_title('') || post_type_archive_title('');
?>
</h1>
<?php
if (is_featured_item()) {
$post_type = get_post_type();
echo '<p>' . get_post_type_object($post_type)->description . '</p>';
} else {
echo category_description();
}
?>
</div>
<?php
}
开发者ID:kkthemes,项目名称:kkthemes,代码行数:28,代码来源:index.php
示例20: smashing_save_post_class_meta
function smashing_save_post_class_meta($post_id, $post)
{
/* Verify the nonce before proceeding. */
if (!isset($_POST['smashing_post_class_nonce']) || !wp_verify_nonce($_POST['smashing_post_class_nonce'], basename(__FILE__))) {
return $post_id;
}
/* Get the post type object. */
$post_type = get_post_type_object($post->post_type);
/* Check if the current user has permission to edit the post. */
if (!current_user_can($post_type->cap->edit_post, $post_id)) {
return $post_id;
}
/* Get the posted data and sanitize it for use as an HTML class. */
$new_meta_value = isset($_POST['smashing-post-class']) ? sanitize_html_class($_POST['smashing-post-class']) : '';
/* Get the meta key. */
$meta_key = 'smashing_post_class';
/* Get the meta value of the custom field key. */
$meta_value = get_post_meta($post_id, $meta_key, true);
/* If a new meta value was added and there was no previous value, add it. */
if ($new_meta_value && '' == $meta_value) {
add_post_meta($post_id, $meta_key, $new_meta_value, true);
} elseif ($new_meta_value && $new_meta_value != $meta_value) {
update_post_meta($post_id, $meta_key, $new_meta_value);
} elseif ('' == $new_meta_value && $meta_value) {
delete_post_meta($post_id, $meta_key, $meta_value);
}
}
开发者ID:OoButt222,项目名称:Version-3,代码行数:27,代码来源:class-doifd-post-meta.php
注:本文中的get_post_type_object函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论