Make WordPress Core


Ignore:
Timestamp:
07/19/2022 04:17:56 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Rename $comment_post_ID and $comment_author_IP variables in various files.

This fixes two WPCS warnings:

  • Variable "$comment_post_ID" is not in valid snake_case format
  • Variable "$comment_author_IP" is not in valid snake_case format

While matching the database fields of the same name, these variables did not follow the WordPress coding standards, and are now renamed to address that.

Note: The name change only affects internal variables and parameters for a few actions receiving a comment post ID:

  • edit_comment
  • comment_id_not_found
  • comment_closed
  • comment_on_trash
  • comment_on_draft
  • comment_on_password_protected
  • pre_comment_on_post

The change does not affect parameters for functions receiving an array of comment data:

  • wp_insert_comment()
  • wp_new_comment()
  • wp_update_comment()
  • wp_handle_comment_submission()

The associated array keys still match the database fields: comment_post_ID and comment_author_IP.

Follow-up to [1706], [2894], [8720], [28427], [28437], [28457], [34799], [53720],

See #55647, #56244.

File:
1 edited

Legend:

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

    r53715 r53723  
    43364336
    43374337    // Expected_slashed (everything!).
    4338     $data = compact( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'post_mime_type', 'guid' );
     4338    $data = compact(
     4339        'post_author',
     4340        'post_date',
     4341        'post_date_gmt',
     4342        'post_content',
     4343        'post_content_filtered',
     4344        'post_title',
     4345        'post_excerpt',
     4346        'post_status',
     4347        'post_type',
     4348        'comment_status',
     4349        'ping_status',
     4350        'post_password',
     4351        'post_name',
     4352        'to_ping',
     4353        'pinged',
     4354        'post_modified',
     4355        'post_modified_gmt',
     4356        'post_parent',
     4357        'menu_order',
     4358        'post_mime_type',
     4359        'guid'
     4360    );
    43394361
    43404362    $emoji_fields = array( 'post_title', 'post_content', 'post_excerpt' );
Note: See TracChangeset for help on using the changeset viewer.