Make WordPress Core


Ignore:
Timestamp:
02/19/2023 03:03:50 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Rename $post_ID variable to $post_id in various files.

The $post_ID variable is technically allowed in WPCS, as there is a global of the same name that needs to remain for backward compatibility. However, this name is mostly a remnant of legacy code, and switching to $post_id where appropriate brings more consistency with the rest of core.

Additionally, this commit resolves a few WPCS warnings in core:

Variable "$post_IDs" is not in valid snake_case format

This affects:

  • Function parameters in:
    • add_meta()
    • post_preview()
    • WP_Embed::delete_oembed_caches()
    • WP_Embed::cache_oembed()
    • wp_get_post_cats()
    • wp_set_post_cats()
    • wp_unique_post_slug()
    • wp_set_post_categories()
    • wp_check_post_hierarchy_for_loops()
    • wp_add_trashed_suffix_to_post_name_for_trashed_posts()
    • wp_filter_wp_template_unique_post_slug()
    • wp_xmlrpc_server::add_enclosure_if_new()
    • wp_xmlrpc_server::attach_uploads()
    • wp_xmlrpc_server::mt_getTrackbackPings()
  • Internal variables in:
    • wp_ajax_inline_save()
    • wp_ajax_set_post_thumbnail()
    • wp_ajax_get_post_thumbnail_html()
    • edit_post()
    • bulk_edit_posts()
    • wp_write_post()
    • WP_Embed::shortcode()
    • wp_insert_post()
    • wp_xmlrpc_server::_insert_post()
    • wp_xmlrpc_server::blogger_getPost()
    • wp_xmlrpc_server::blogger_newPost()
    • wp_xmlrpc_server::blogger_editPost()
    • wp_xmlrpc_server::blogger_deletePost()
    • wp_xmlrpc_server::mw_getPost()
    • wp_xmlrpc_server::mw_newPost()
    • wp_xmlrpc_server::mw_editPost()
    • wp_xmlrpc_server::mt_getPostCategories()
    • wp_xmlrpc_server::mt_setPostCategories()
    • wp_xmlrpc_server::mt_publishPost()
    • wp_xmlrpc_server::pingback_ping()
  • Hook parameters in:
    • oembed_ttl
    • embed_oembed_html
    • wp_insert_post_parent
    • add_trashed_suffix_to_trashed_posts
    • pre_post_update
    • edit_attachment
    • attachment_updated
    • add_attachment
    • edit_post_{$post->post_type}
    • edit_post
    • post_updated
    • save_post_{$post->post_type}
    • save_post
    • wp_insert_post
    • pre_wp_unique_post_slug
    • wp_unique_post_slug
    • xmlrpc_call_success_blogger_newPost
    • xmlrpc_call_success_blogger_editPost
    • xmlrpc_call_success_blogger_deletePost
    • xmlrpc_call_success_mw_newPost
    • xmlrpc_call_success_mw_editPost

Note: The name change only affects variable names and DocBlocks.

The change does not affect the $post_ID global still used in a few places.

Follow-up to [51399], [52958], [53723], [53729], [55190], [55308], [55334].

Props mahekkalola, tanjimtc71, SergeyBiryukov.
Fixes #57692.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post.php

    r55252 r55365  
    40944094
    40954095    // Are we updating or creating?
    4096     $post_ID = 0;
     4096    $post_id = 0;
    40974097    $update  = false;
    40984098    $guid    = $postarr['guid'];
     
    41024102
    41034103        // 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 );
    41064106
    41074107        if ( is_null( $post_before ) ) {
     
    41124112        }
    41134113
    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 );
    41164116    } else {
    41174117        $previous_status = 'new';
     
    41954195        if ( ! $update && $post_type_object && ! current_user_can( $post_type_object->cap->publish_posts ) ) {
    41964196            $post_name = '';
    4197         } elseif ( $update && ! current_user_can( 'publish_post', $post_ID ) ) {
     4197        } elseif ( $update && ! current_user_can( 'publish_post', $post_id ) ) {
    41984198            $post_name = '';
    41994199        }
     
    42144214        $check_name = sanitize_title( $post_name, '', 'old-save' );
    42154215
    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 ) {
    42174217            $post_name = $check_name;
    42184218        } else { // New post, or slug has changed.
     
    43094309    $new_postarr = array_merge(
    43104310        array(
    4311             'ID' => $post_ID,
     4311            'ID' => $post_id,
    43124312        ),
    43134313        compact( array_diff( array_keys( $defaults ), array( 'context', 'filter' ) ) )
     
    43204320     *
    43214321     * @param int   $post_parent Post parent ID.
    4322      * @param int   $post_ID     Post ID.
     4322     * @param int   $post_id     Post ID.
    43234323     * @param array $new_postarr Array of parsed post data.
    43244324     * @param array $postarr     Array of sanitized, but otherwise unmodified post data.
    43254325     */
    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 );
    43274327
    43284328    /*
     
    43314331     */
    43324332    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 );
    43344334
    43354335        if ( $desired_post_slug ) {
    4336             delete_post_meta( $post_ID, '_wp_desired_post_slug' );
     4336            delete_post_meta( $post_id, '_wp_desired_post_slug' );
    43374337            $post_name = $desired_post_slug;
    43384338        }
     
    43484348         * @param bool   $add_trashed_suffix Whether to attempt to add the suffix.
    43494349         * @param string $post_name          The name of the post being updated.
    4350          * @param int    $post_ID            Post ID.
     4350         * @param int    $post_id            Post ID.
    43514351         */
    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 );
    43534353
    43544354        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 );
    43564356        }
    43574357    }
     
    43594359    // When trashing an existing post, change its slug to allow non-trashed posts to use it.
    43604360    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 );
    43654365
    43664366    // Don't unslash.
     
    44374437
    44384438    $data  = wp_unslash( $data );
    4439     $where = array( 'ID' => $post_ID );
     4439    $where = array( 'ID' => $post_id );
    44404440
    44414441    if ( $update ) {
     
    44454445         * @since 2.5.0
    44464446         *
    4447          * @param int   $post_ID Post ID.
     4447         * @param int   $post_id Post ID.
    44484448         * @param array $data    Array of unslashed post data.
    44494449         */
    4450         do_action( 'pre_post_update', $post_ID, $data );
     4450        do_action( 'pre_post_update', $post_id, $data );
    44514451
    44524452        if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) {
     
    44874487        }
    44884488
    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 );
    44934493    }
    44944494
    44954495    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 );
    44974497
    44984498        $wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where );
    4499         clean_post_cache( $post_ID );
     4499        clean_post_cache( $post_id );
    45004500    }
    45014501
    45024502    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 );
    45044504    }
    45054505
    45064506    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'] );
    45084508    }
    45094509
     
    45204520
    45214521                // 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' ) );
    45234523                if ( ! empty( $terms ) && empty( $postarr['tax_input'][ $taxonomy ] ) ) {
    45244524                    $postarr['tax_input'][ $taxonomy ] = $terms;
     
    45524552
    45534553            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 );
    45554555            }
    45564556        }
     
    45594559    if ( ! empty( $postarr['meta_input'] ) ) {
    45604560        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 );
    45664566
    45674567    // Set GUID.
    45684568    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 );
    45704570    }
    45714571
    45724572    if ( 'attachment' === $postarr['post_type'] ) {
    45734573        if ( ! empty( $postarr['file'] ) ) {
    4574             update_attached_file( $post_ID, $postarr['file'] );
     4574            update_attached_file( $post_id, $postarr['file'] );
    45754575        }
    45764576
    45774577        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 );
    45794579        }
    45804580    }
     
    45854585
    45864586        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 ) ) {
    45884588                $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 ) ) {
    45904590                $thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' );
    45914591            }
     
    45954595            $thumbnail_id = (int) $postarr['_thumbnail_id'];
    45964596            if ( -1 === $thumbnail_id ) {
    4597                 delete_post_thumbnail( $post_ID );
     4597                delete_post_thumbnail( $post_id );
    45984598            } else {
    4599                 set_post_thumbnail( $post_ID, $thumbnail_id );
     4599                set_post_thumbnail( $post_id, $thumbnail_id );
    46004600            }
    46014601        }
    46024602    }
    46034603
    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 );
    46074607
    46084608    if ( ! empty( $postarr['page_template'] ) ) {
     
    46154615            }
    46164616
    4617             update_post_meta( $post_ID, '_wp_page_template', 'default' );
     4617            update_post_meta( $post_id, '_wp_page_template', 'default' );
    46184618        } 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'] );
    46204620        }
    46214621    }
     
    46304630             * @since 2.0.0
    46314631             *
    4632              * @param int $post_ID Attachment ID.
     4632             * @param int $post_id Attachment ID.
    46334633             */
    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 );
    46374637
    46384638            /**
     
    46414641             * @since 4.4.0
    46424642             *
    4643              * @param int     $post_ID      Post ID.
     4643             * @param int     $post_id      Post ID.
    46444644             * @param WP_Post $post_after   Post object following the update.
    46454645             * @param WP_Post $post_before  Post object before the update.
    46464646             */
    4647             do_action( 'attachment_updated', $post_ID, $post_after, $post_before );
     4647            do_action( 'attachment_updated', $post_id, $post_after, $post_before );
    46484648        } else {
    46494649
     
    46534653             * @since 2.0.0
    46544654             *
    4655              * @param int $post_ID Attachment ID.
     4655             * @param int $post_id Attachment ID.
    46564656             */
    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;
    46614661    }
    46624662
     
    46754675         * @since 5.1.0
    46764676         *
    4677          * @param int     $post_ID Post ID.
     4677         * @param int     $post_id Post ID.
    46784678         * @param WP_Post $post    Post object.
    46794679         */
    4680         do_action( "edit_post_{$post->post_type}", $post_ID, $post );
     4680        do_action( "edit_post_{$post->post_type}", $post_id, $post );
    46814681
    46824682        /**
     
    46854685         * @since 1.2.0
    46864686         *
    4687          * @param int     $post_ID Post ID.
     4687         * @param int     $post_id Post ID.
    46884688         * @param WP_Post $post    Post object.
    46894689         */
    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 );
    46934693
    46944694        /**
     
    46974697         * @since 3.0.0
    46984698         *
    4699          * @param int     $post_ID      Post ID.
     4699         * @param int     $post_id      Post ID.
    47004700         * @param WP_Post $post_after   Post object following the update.
    47014701         * @param WP_Post $post_before  Post object before the update.
    47024702         */
    4703         do_action( 'post_updated', $post_ID, $post_after, $post_before );
     4703        do_action( 'post_updated', $post_id, $post_after, $post_before );
    47044704    }
    47054705
     
    47174717     * @since 3.7.0
    47184718     *
    4719      * @param int     $post_ID Post ID.
     4719     * @param int     $post_id Post ID.
    47204720     * @param WP_Post $post    Post object.
    47214721     * @param bool    $update  Whether this is an existing post being updated.
    47224722     */
    4723     do_action( "save_post_{$post->post_type}", $post_ID, $post, $update );
     4723    do_action( "save_post_{$post->post_type}", $post_id, $post, $update );
    47244724
    47254725    /**
     
    47284728     * @since 1.5.0
    47294729     *
    4730      * @param int     $post_ID Post ID.
     4730     * @param int     $post_id Post ID.
    47314731     * @param WP_Post $post    Post object.
    47324732     * @param bool    $update  Whether this is an existing post being updated.
    47334733     */
    4734     do_action( 'save_post', $post_ID, $post, $update );
     4734    do_action( 'save_post', $post_id, $post, $update );
    47354735
    47364736    /**
     
    47394739     * @since 2.0.0
    47404740     *
    4741      * @param int     $post_ID Post ID.
     4741     * @param int     $post_id Post ID.
    47424742     * @param WP_Post $post    Post object.
    47434743     * @param bool    $update  Whether this is an existing post being updated.
    47444744     */
    4745     do_action( 'wp_insert_post', $post_ID, $post, $update );
     4745    do_action( 'wp_insert_post', $post_id, $post, $update );
    47464746
    47474747    if ( $fire_after_hooks ) {
     
    47494749    }
    47504750
    4751     return $post_ID;
     4751    return $post_id;
    47524752}
    47534753
     
    49944994 *
    49954995 * @param string $slug        The desired slug (post_name).
    4996  * @param int    $post_ID     Post ID.
     4996 * @param int    $post_id     Post ID.
    49974997 * @param string $post_status No uniqueness checks are made if the post is still draft or pending.
    49984998 * @param string $post_type   Post type.
     
    50005000 * @return string Unique slug for the post, based on $post_name (with a -1, -2, etc. suffix)
    50015001 */
    5002 function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent ) {
     5002function wp_unique_post_slug( $slug, $post_id, $post_status, $post_type, $post_parent ) {
    50035003    if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ), true )
    50045004        || ( 'inherit' === $post_status && 'revision' === $post_type ) || 'user_request' === $post_type
     
    50175017     * @param string|null $override_slug Short-circuit return value.
    50185018     * @param string      $slug          The desired slug (post_name).
    5019      * @param int         $post_ID       Post ID.
     5019     * @param int         $post_id       Post ID.
    50205020     * @param string      $post_status   The post status.
    50215021     * @param string      $post_type     Post type.
    50225022     * @param int         $post_parent   Post parent ID.
    50235023     */
    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 );
    50255025    if ( null !== $override_slug ) {
    50265026        return $override_slug;
     
    50395039        // Attachment slugs must be unique across all types.
    50405040        $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 ) );
    50425042
    50435043        /**
     
    50585058            do {
    50595059                $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 ) );
    50615061                $suffix++;
    50625062            } while ( $post_name_check );
     
    50735073         */
    50745074        $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 ) );
    50765076
    50775077        /**
     
    50955095            do {
    50965096                $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 ) );
    50985098                $suffix++;
    50995099            } while ( $post_name_check );
     
    51035103        // Post slugs must be unique across all posts.
    51045104        $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 );
    51085108
    51095109        // Prevent new post slugs that could result in URLs that conflict with date archives.
     
    51515151            do {
    51525152                $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 ) );
    51545154                $suffix++;
    51555155            } while ( $post_name_check );
     
    51645164     *
    51655165     * @param string $slug          The post slug.
    5166      * @param int    $post_ID       Post ID.
     5166     * @param int    $post_id       Post ID.
    51675167     * @param string $post_status   The post status.
    51685168     * @param string $post_type     Post type.
     
    51705170     * @param string $original_slug The original post slug.
    51715171     */
    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 );
    51735173}
    51745174
     
    52865286 * @since 2.1.0
    52875287 *
    5288  * @param int       $post_ID         Optional. The Post ID. Does not default to the ID
     5288 * @param int       $post_id         Optional. The Post ID. Does not default to the ID
    52895289 *                                   of the global $post. Default 0.
    52905290 * @param int[]|int $post_categories Optional. List of category IDs, or the ID of a single category.
     
    52945294 * @return array|false|WP_Error Array of term taxonomy IDs of affected categories. WP_Error or false on failure.
    52955295 */
    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 );
     5296function 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 );
    53005300
    53015301    // If $post_categories isn't already an array, make it one.
     
    53285328    }
    53295329
    5330     return wp_set_post_terms( $post_ID, $post_categories, 'category', $append );
     5330    return wp_set_post_terms( $post_id, $post_categories, 'category', $append );
    53315331}
    53325332
     
    76727672 *
    76737673 * @param int $post_parent ID of the parent for the post we're checking.
    7674  * @param int $post_ID     ID of the post we're checking.
     7674 * @param int $post_id     ID of the post we're checking.
    76757675 * @return int The new post_parent for the post, 0 otherwise.
    76767676 */
    7677 function wp_check_post_hierarchy_for_loops( $post_parent, $post_ID ) {
     7677function wp_check_post_hierarchy_for_loops( $post_parent, $post_id ) {
    76787678    // Nothing fancy here - bail.
    76797679    if ( ! $post_parent ) {
     
    76827682
    76837683    // New post can't cause a loop.
    7684     if ( ! $post_ID ) {
     7684    if ( ! $post_id ) {
    76857685        return $post_parent;
    76867686    }
    76877687
    76887688    // Can't be its own parent.
    7689     if ( $post_parent == $post_ID ) {
     7689    if ( $post_parent == $post_id ) {
    76907690        return 0;
    76917691    }
    76927692
    76937693    // 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 );
    76957695    if ( ! $loop ) {
    76967696        return $post_parent; // No loop.
     
    76987698
    76997699    // Setting $post_parent to the given value causes a loop.
    7700     if ( isset( $loop[ $post_ID ] ) ) {
     7700    if ( isset( $loop[ $post_id ] ) ) {
    77017701        return 0;
    77027702    }
    77037703
    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.
    77057705    foreach ( array_keys( $loop ) as $loop_member ) {
    77067706        wp_update_post(
     
    79187918 *
    79197919 * @param string $post_name Post slug.
    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 ) {
     7920 * @param int    $post_id   Optional. Post ID that should be ignored. Default 0.
     7921 */
     7922function wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_id = 0 ) {
    79237923    $trashed_posts_with_desired_slug = get_posts(
    79247924        array(
     
    79277927            'post_type'    => 'any',
    79287928            'nopaging'     => true,
    7929             'post__not_in' => array( $post_ID ),
     7929            'post__not_in' => array( $post_id ),
    79307930        )
    79317931    );
Note: See TracChangeset for help on using the changeset viewer.