Changeset 55365 for trunk/src/wp-includes/post.php
- Timestamp:
- 02/19/2023 03:03:50 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r55252 r55365 4094 4094 4095 4095 // Are we updating or creating? 4096 $post_ ID= 0;4096 $post_id = 0; 4097 4097 $update = false; 4098 4098 $guid = $postarr['guid']; … … 4102 4102 4103 4103 // Get the post ID and GUID. 4104 $post_ ID= $postarr['ID'];4105 $post_before = get_post( $post_ ID);4104 $post_id = $postarr['ID']; 4105 $post_before = get_post( $post_id ); 4106 4106 4107 4107 if ( is_null( $post_before ) ) { … … 4112 4112 } 4113 4113 4114 $guid = get_post_field( 'guid', $post_ ID);4115 $previous_status = get_post_field( 'post_status', $post_ ID);4114 $guid = get_post_field( 'guid', $post_id ); 4115 $previous_status = get_post_field( 'post_status', $post_id ); 4116 4116 } else { 4117 4117 $previous_status = 'new'; … … 4195 4195 if ( ! $update && $post_type_object && ! current_user_can( $post_type_object->cap->publish_posts ) ) { 4196 4196 $post_name = ''; 4197 } elseif ( $update && ! current_user_can( 'publish_post', $post_ ID) ) {4197 } elseif ( $update && ! current_user_can( 'publish_post', $post_id ) ) { 4198 4198 $post_name = ''; 4199 4199 } … … 4214 4214 $check_name = sanitize_title( $post_name, '', 'old-save' ); 4215 4215 4216 if ( $update && strtolower( urlencode( $post_name ) ) == $check_name && get_post_field( 'post_name', $post_ ID) == $check_name ) {4216 if ( $update && strtolower( urlencode( $post_name ) ) == $check_name && get_post_field( 'post_name', $post_id ) == $check_name ) { 4217 4217 $post_name = $check_name; 4218 4218 } else { // New post, or slug has changed. … … 4309 4309 $new_postarr = array_merge( 4310 4310 array( 4311 'ID' => $post_ ID,4311 'ID' => $post_id, 4312 4312 ), 4313 4313 compact( array_diff( array_keys( $defaults ), array( 'context', 'filter' ) ) ) … … 4320 4320 * 4321 4321 * @param int $post_parent Post parent ID. 4322 * @param int $post_ IDPost ID.4322 * @param int $post_id Post ID. 4323 4323 * @param array $new_postarr Array of parsed post data. 4324 4324 * @param array $postarr Array of sanitized, but otherwise unmodified post data. 4325 4325 */ 4326 $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ ID, $new_postarr, $postarr );4326 $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_id, $new_postarr, $postarr ); 4327 4327 4328 4328 /* … … 4331 4331 */ 4332 4332 if ( 'trash' === $previous_status && 'trash' !== $post_status ) { 4333 $desired_post_slug = get_post_meta( $post_ ID, '_wp_desired_post_slug', true );4333 $desired_post_slug = get_post_meta( $post_id, '_wp_desired_post_slug', true ); 4334 4334 4335 4335 if ( $desired_post_slug ) { 4336 delete_post_meta( $post_ ID, '_wp_desired_post_slug' );4336 delete_post_meta( $post_id, '_wp_desired_post_slug' ); 4337 4337 $post_name = $desired_post_slug; 4338 4338 } … … 4348 4348 * @param bool $add_trashed_suffix Whether to attempt to add the suffix. 4349 4349 * @param string $post_name The name of the post being updated. 4350 * @param int $post_ IDPost ID.4350 * @param int $post_id Post ID. 4351 4351 */ 4352 $add_trashed_suffix = apply_filters( 'add_trashed_suffix_to_trashed_posts', true, $post_name, $post_ ID);4352 $add_trashed_suffix = apply_filters( 'add_trashed_suffix_to_trashed_posts', true, $post_name, $post_id ); 4353 4353 4354 4354 if ( $add_trashed_suffix ) { 4355 wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_ ID);4355 wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_id ); 4356 4356 } 4357 4357 } … … 4359 4359 // When trashing an existing post, change its slug to allow non-trashed posts to use it. 4360 4360 if ( 'trash' === $post_status && 'trash' !== $previous_status && 'new' !== $previous_status ) { 4361 $post_name = wp_add_trashed_suffix_to_post_name_for_post( $post_ ID);4362 } 4363 4364 $post_name = wp_unique_post_slug( $post_name, $post_ ID, $post_status, $post_type, $post_parent );4361 $post_name = wp_add_trashed_suffix_to_post_name_for_post( $post_id ); 4362 } 4363 4364 $post_name = wp_unique_post_slug( $post_name, $post_id, $post_status, $post_type, $post_parent ); 4365 4365 4366 4366 // Don't unslash. … … 4437 4437 4438 4438 $data = wp_unslash( $data ); 4439 $where = array( 'ID' => $post_ ID);4439 $where = array( 'ID' => $post_id ); 4440 4440 4441 4441 if ( $update ) { … … 4445 4445 * @since 2.5.0 4446 4446 * 4447 * @param int $post_ IDPost ID.4447 * @param int $post_id Post ID. 4448 4448 * @param array $data Array of unslashed post data. 4449 4449 */ 4450 do_action( 'pre_post_update', $post_ ID, $data );4450 do_action( 'pre_post_update', $post_id, $data ); 4451 4451 4452 4452 if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) { … … 4487 4487 } 4488 4488 4489 $post_ ID= (int) $wpdb->insert_id;4490 4491 // Use the newly generated $post_ ID.4492 $where = array( 'ID' => $post_ ID);4489 $post_id = (int) $wpdb->insert_id; 4490 4491 // Use the newly generated $post_id. 4492 $where = array( 'ID' => $post_id ); 4493 4493 } 4494 4494 4495 4495 if ( empty( $data['post_name'] ) && ! in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ), true ) ) { 4496 $data['post_name'] = wp_unique_post_slug( sanitize_title( $data['post_title'], $post_ ID ), $post_ID, $data['post_status'], $post_type, $post_parent );4496 $data['post_name'] = wp_unique_post_slug( sanitize_title( $data['post_title'], $post_id ), $post_id, $data['post_status'], $post_type, $post_parent ); 4497 4497 4498 4498 $wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where ); 4499 clean_post_cache( $post_ ID);4499 clean_post_cache( $post_id ); 4500 4500 } 4501 4501 4502 4502 if ( is_object_in_taxonomy( $post_type, 'category' ) ) { 4503 wp_set_post_categories( $post_ ID, $post_category );4503 wp_set_post_categories( $post_id, $post_category ); 4504 4504 } 4505 4505 4506 4506 if ( isset( $postarr['tags_input'] ) && is_object_in_taxonomy( $post_type, 'post_tag' ) ) { 4507 wp_set_post_tags( $post_ ID, $postarr['tags_input'] );4507 wp_set_post_tags( $post_id, $postarr['tags_input'] ); 4508 4508 } 4509 4509 … … 4520 4520 4521 4521 // Passed custom taxonomy list overwrites the existing list if not empty. 4522 $terms = wp_get_object_terms( $post_ ID, $taxonomy, array( 'fields' => 'ids' ) );4522 $terms = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'ids' ) ); 4523 4523 if ( ! empty( $terms ) && empty( $postarr['tax_input'][ $taxonomy ] ) ) { 4524 4524 $postarr['tax_input'][ $taxonomy ] = $terms; … … 4552 4552 4553 4553 if ( current_user_can( $taxonomy_obj->cap->assign_terms ) ) { 4554 wp_set_post_terms( $post_ ID, $tags, $taxonomy );4554 wp_set_post_terms( $post_id, $tags, $taxonomy ); 4555 4555 } 4556 4556 } … … 4559 4559 if ( ! empty( $postarr['meta_input'] ) ) { 4560 4560 foreach ( $postarr['meta_input'] as $field => $value ) { 4561 update_post_meta( $post_ ID, $field, $value );4562 } 4563 } 4564 4565 $current_guid = get_post_field( 'guid', $post_ ID);4561 update_post_meta( $post_id, $field, $value ); 4562 } 4563 } 4564 4565 $current_guid = get_post_field( 'guid', $post_id ); 4566 4566 4567 4567 // Set GUID. 4568 4568 if ( ! $update && '' === $current_guid ) { 4569 $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_ ID) ), $where );4569 $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_id ) ), $where ); 4570 4570 } 4571 4571 4572 4572 if ( 'attachment' === $postarr['post_type'] ) { 4573 4573 if ( ! empty( $postarr['file'] ) ) { 4574 update_attached_file( $post_ ID, $postarr['file'] );4574 update_attached_file( $post_id, $postarr['file'] ); 4575 4575 } 4576 4576 4577 4577 if ( ! empty( $postarr['context'] ) ) { 4578 add_post_meta( $post_ ID, '_wp_attachment_context', $postarr['context'], true );4578 add_post_meta( $post_id, '_wp_attachment_context', $postarr['context'], true ); 4579 4579 } 4580 4580 } … … 4585 4585 4586 4586 if ( ! $thumbnail_support && 'attachment' === $post_type && $post_mime_type ) { 4587 if ( wp_attachment_is( 'audio', $post_ ID) ) {4587 if ( wp_attachment_is( 'audio', $post_id ) ) { 4588 4588 $thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' ); 4589 } elseif ( wp_attachment_is( 'video', $post_ ID) ) {4589 } elseif ( wp_attachment_is( 'video', $post_id ) ) { 4590 4590 $thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' ); 4591 4591 } … … 4595 4595 $thumbnail_id = (int) $postarr['_thumbnail_id']; 4596 4596 if ( -1 === $thumbnail_id ) { 4597 delete_post_thumbnail( $post_ ID);4597 delete_post_thumbnail( $post_id ); 4598 4598 } else { 4599 set_post_thumbnail( $post_ ID, $thumbnail_id );4599 set_post_thumbnail( $post_id, $thumbnail_id ); 4600 4600 } 4601 4601 } 4602 4602 } 4603 4603 4604 clean_post_cache( $post_ ID);4605 4606 $post = get_post( $post_ ID);4604 clean_post_cache( $post_id ); 4605 4606 $post = get_post( $post_id ); 4607 4607 4608 4608 if ( ! empty( $postarr['page_template'] ) ) { … … 4615 4615 } 4616 4616 4617 update_post_meta( $post_ ID, '_wp_page_template', 'default' );4617 update_post_meta( $post_id, '_wp_page_template', 'default' ); 4618 4618 } else { 4619 update_post_meta( $post_ ID, '_wp_page_template', $postarr['page_template'] );4619 update_post_meta( $post_id, '_wp_page_template', $postarr['page_template'] ); 4620 4620 } 4621 4621 } … … 4630 4630 * @since 2.0.0 4631 4631 * 4632 * @param int $post_ IDAttachment ID.4632 * @param int $post_id Attachment ID. 4633 4633 */ 4634 do_action( 'edit_attachment', $post_ ID);4635 4636 $post_after = get_post( $post_ ID);4634 do_action( 'edit_attachment', $post_id ); 4635 4636 $post_after = get_post( $post_id ); 4637 4637 4638 4638 /** … … 4641 4641 * @since 4.4.0 4642 4642 * 4643 * @param int $post_ IDPost ID.4643 * @param int $post_id Post ID. 4644 4644 * @param WP_Post $post_after Post object following the update. 4645 4645 * @param WP_Post $post_before Post object before the update. 4646 4646 */ 4647 do_action( 'attachment_updated', $post_ ID, $post_after, $post_before );4647 do_action( 'attachment_updated', $post_id, $post_after, $post_before ); 4648 4648 } else { 4649 4649 … … 4653 4653 * @since 2.0.0 4654 4654 * 4655 * @param int $post_ IDAttachment ID.4655 * @param int $post_id Attachment ID. 4656 4656 */ 4657 do_action( 'add_attachment', $post_ ID);4658 } 4659 4660 return $post_ ID;4657 do_action( 'add_attachment', $post_id ); 4658 } 4659 4660 return $post_id; 4661 4661 } 4662 4662 … … 4675 4675 * @since 5.1.0 4676 4676 * 4677 * @param int $post_ IDPost ID.4677 * @param int $post_id Post ID. 4678 4678 * @param WP_Post $post Post object. 4679 4679 */ 4680 do_action( "edit_post_{$post->post_type}", $post_ ID, $post );4680 do_action( "edit_post_{$post->post_type}", $post_id, $post ); 4681 4681 4682 4682 /** … … 4685 4685 * @since 1.2.0 4686 4686 * 4687 * @param int $post_ IDPost ID.4687 * @param int $post_id Post ID. 4688 4688 * @param WP_Post $post Post object. 4689 4689 */ 4690 do_action( 'edit_post', $post_ ID, $post );4691 4692 $post_after = get_post( $post_ ID);4690 do_action( 'edit_post', $post_id, $post ); 4691 4692 $post_after = get_post( $post_id ); 4693 4693 4694 4694 /** … … 4697 4697 * @since 3.0.0 4698 4698 * 4699 * @param int $post_ IDPost ID.4699 * @param int $post_id Post ID. 4700 4700 * @param WP_Post $post_after Post object following the update. 4701 4701 * @param WP_Post $post_before Post object before the update. 4702 4702 */ 4703 do_action( 'post_updated', $post_ ID, $post_after, $post_before );4703 do_action( 'post_updated', $post_id, $post_after, $post_before ); 4704 4704 } 4705 4705 … … 4717 4717 * @since 3.7.0 4718 4718 * 4719 * @param int $post_ IDPost ID.4719 * @param int $post_id Post ID. 4720 4720 * @param WP_Post $post Post object. 4721 4721 * @param bool $update Whether this is an existing post being updated. 4722 4722 */ 4723 do_action( "save_post_{$post->post_type}", $post_ ID, $post, $update );4723 do_action( "save_post_{$post->post_type}", $post_id, $post, $update ); 4724 4724 4725 4725 /** … … 4728 4728 * @since 1.5.0 4729 4729 * 4730 * @param int $post_ IDPost ID.4730 * @param int $post_id Post ID. 4731 4731 * @param WP_Post $post Post object. 4732 4732 * @param bool $update Whether this is an existing post being updated. 4733 4733 */ 4734 do_action( 'save_post', $post_ ID, $post, $update );4734 do_action( 'save_post', $post_id, $post, $update ); 4735 4735 4736 4736 /** … … 4739 4739 * @since 2.0.0 4740 4740 * 4741 * @param int $post_ IDPost ID.4741 * @param int $post_id Post ID. 4742 4742 * @param WP_Post $post Post object. 4743 4743 * @param bool $update Whether this is an existing post being updated. 4744 4744 */ 4745 do_action( 'wp_insert_post', $post_ ID, $post, $update );4745 do_action( 'wp_insert_post', $post_id, $post, $update ); 4746 4746 4747 4747 if ( $fire_after_hooks ) { … … 4749 4749 } 4750 4750 4751 return $post_ ID;4751 return $post_id; 4752 4752 } 4753 4753 … … 4994 4994 * 4995 4995 * @param string $slug The desired slug (post_name). 4996 * @param int $post_ IDPost ID.4996 * @param int $post_id Post ID. 4997 4997 * @param string $post_status No uniqueness checks are made if the post is still draft or pending. 4998 4998 * @param string $post_type Post type. … … 5000 5000 * @return string Unique slug for the post, based on $post_name (with a -1, -2, etc. suffix) 5001 5001 */ 5002 function wp_unique_post_slug( $slug, $post_ ID, $post_status, $post_type, $post_parent ) {5002 function wp_unique_post_slug( $slug, $post_id, $post_status, $post_type, $post_parent ) { 5003 5003 if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ), true ) 5004 5004 || ( 'inherit' === $post_status && 'revision' === $post_type ) || 'user_request' === $post_type … … 5017 5017 * @param string|null $override_slug Short-circuit return value. 5018 5018 * @param string $slug The desired slug (post_name). 5019 * @param int $post_ IDPost ID.5019 * @param int $post_id Post ID. 5020 5020 * @param string $post_status The post status. 5021 5021 * @param string $post_type Post type. 5022 5022 * @param int $post_parent Post parent ID. 5023 5023 */ 5024 $override_slug = apply_filters( 'pre_wp_unique_post_slug', null, $slug, $post_ ID, $post_status, $post_type, $post_parent );5024 $override_slug = apply_filters( 'pre_wp_unique_post_slug', null, $slug, $post_id, $post_status, $post_type, $post_parent ); 5025 5025 if ( null !== $override_slug ) { 5026 5026 return $override_slug; … … 5039 5039 // Attachment slugs must be unique across all types. 5040 5040 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1"; 5041 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ ID) );5041 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_id ) ); 5042 5042 5043 5043 /** … … 5058 5058 do { 5059 5059 $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; 5060 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_ ID) );5060 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_id ) ); 5061 5061 $suffix++; 5062 5062 } while ( $post_name_check ); … … 5073 5073 */ 5074 5074 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( %s, 'attachment' ) AND ID != %d AND post_parent = %d LIMIT 1"; 5075 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ ID, $post_parent ) );5075 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_id, $post_parent ) ); 5076 5076 5077 5077 /** … … 5095 5095 do { 5096 5096 $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; 5097 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ ID, $post_parent ) );5097 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_id, $post_parent ) ); 5098 5098 $suffix++; 5099 5099 } while ( $post_name_check ); … … 5103 5103 // Post slugs must be unique across all posts. 5104 5104 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1"; 5105 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ ID) );5106 5107 $post = get_post( $post_ ID);5105 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_id ) ); 5106 5107 $post = get_post( $post_id ); 5108 5108 5109 5109 // Prevent new post slugs that could result in URLs that conflict with date archives. … … 5151 5151 do { 5152 5152 $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; 5153 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ ID) );5153 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_id ) ); 5154 5154 $suffix++; 5155 5155 } while ( $post_name_check ); … … 5164 5164 * 5165 5165 * @param string $slug The post slug. 5166 * @param int $post_ IDPost ID.5166 * @param int $post_id Post ID. 5167 5167 * @param string $post_status The post status. 5168 5168 * @param string $post_type Post type. … … 5170 5170 * @param string $original_slug The original post slug. 5171 5171 */ 5172 return apply_filters( 'wp_unique_post_slug', $slug, $post_ ID, $post_status, $post_type, $post_parent, $original_slug );5172 return apply_filters( 'wp_unique_post_slug', $slug, $post_id, $post_status, $post_type, $post_parent, $original_slug ); 5173 5173 } 5174 5174 … … 5286 5286 * @since 2.1.0 5287 5287 * 5288 * @param int $post_ IDOptional. The Post ID. Does not default to the ID5288 * @param int $post_id Optional. The Post ID. Does not default to the ID 5289 5289 * of the global $post. Default 0. 5290 5290 * @param int[]|int $post_categories Optional. List of category IDs, or the ID of a single category. … … 5294 5294 * @return array|false|WP_Error Array of term taxonomy IDs of affected categories. WP_Error or false on failure. 5295 5295 */ 5296 function wp_set_post_categories( $post_ ID= 0, $post_categories = array(), $append = false ) {5297 $post_ ID = (int) $post_ID;5298 $post_type = get_post_type( $post_ ID);5299 $post_status = get_post_status( $post_ ID);5296 function wp_set_post_categories( $post_id = 0, $post_categories = array(), $append = false ) { 5297 $post_id = (int) $post_id; 5298 $post_type = get_post_type( $post_id ); 5299 $post_status = get_post_status( $post_id ); 5300 5300 5301 5301 // If $post_categories isn't already an array, make it one. … … 5328 5328 } 5329 5329 5330 return wp_set_post_terms( $post_ ID, $post_categories, 'category', $append );5330 return wp_set_post_terms( $post_id, $post_categories, 'category', $append ); 5331 5331 } 5332 5332 … … 7672 7672 * 7673 7673 * @param int $post_parent ID of the parent for the post we're checking. 7674 * @param int $post_ IDID of the post we're checking.7674 * @param int $post_id ID of the post we're checking. 7675 7675 * @return int The new post_parent for the post, 0 otherwise. 7676 7676 */ 7677 function wp_check_post_hierarchy_for_loops( $post_parent, $post_ ID) {7677 function wp_check_post_hierarchy_for_loops( $post_parent, $post_id ) { 7678 7678 // Nothing fancy here - bail. 7679 7679 if ( ! $post_parent ) { … … 7682 7682 7683 7683 // New post can't cause a loop. 7684 if ( ! $post_ ID) {7684 if ( ! $post_id ) { 7685 7685 return $post_parent; 7686 7686 } 7687 7687 7688 7688 // Can't be its own parent. 7689 if ( $post_parent == $post_ ID) {7689 if ( $post_parent == $post_id ) { 7690 7690 return 0; 7691 7691 } 7692 7692 7693 7693 // Now look for larger loops. 7694 $loop = wp_find_hierarchy_loop( 'wp_get_post_parent_id', $post_ ID, $post_parent );7694 $loop = wp_find_hierarchy_loop( 'wp_get_post_parent_id', $post_id, $post_parent ); 7695 7695 if ( ! $loop ) { 7696 7696 return $post_parent; // No loop. … … 7698 7698 7699 7699 // Setting $post_parent to the given value causes a loop. 7700 if ( isset( $loop[ $post_ ID] ) ) {7700 if ( isset( $loop[ $post_id ] ) ) { 7701 7701 return 0; 7702 7702 } 7703 7703 7704 // There's a loop, but it doesn't contain $post_ ID. Break the loop.7704 // There's a loop, but it doesn't contain $post_id. Break the loop. 7705 7705 foreach ( array_keys( $loop ) as $loop_member ) { 7706 7706 wp_update_post( … … 7918 7918 * 7919 7919 * @param string $post_name Post slug. 7920 * @param int $post_ IDOptional. Post ID that should be ignored. Default 0.7921 */ 7922 function wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_ ID= 0 ) {7920 * @param int $post_id Optional. Post ID that should be ignored. Default 0. 7921 */ 7922 function wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_id = 0 ) { 7923 7923 $trashed_posts_with_desired_slug = get_posts( 7924 7924 array( … … 7927 7927 'post_type' => 'any', 7928 7928 'nopaging' => true, 7929 'post__not_in' => array( $post_ ID),7929 'post__not_in' => array( $post_id ), 7930 7930 ) 7931 7931 );
Note: See TracChangeset
for help on using the changeset viewer.