Make WordPress Core

Changeset 59045


Ignore:
Timestamp:
09/18/2024 12:00:08 AM (2 years ago)
Author:
DrewAPicture
Message:

Docs: Add possible filter names to the hook docs for the following filters in sanitize_post_field():

  • edit_{$field}
  • {$field_no_prefix}_edit_pre
  • edit_post_{$field}
  • pre_{$field}
  • {$field_no_prefix}_save_pre
  • pre_post_{$field}
  • {$field}_pre
  • {$field}
  • post_{$field}

Props johnbillion, DrewAPicture.
Fixes #50654

File:
1 edited

Legend:

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

    r59009 r59045  
    28972897                         *
    28982898                         * The dynamic portion of the hook name, `$field`, refers to the post
    2899                          * field name.
     2899                         * field name. Possible filter names include:
     2900                         *
     2901                         *  - `edit_post_author`
     2902                         *  - `edit_post_date`
     2903                         *  - `edit_post_date_gmt`
     2904                         *  - `edit_post_content`
     2905                         *  - `edit_post_title`
     2906                         *  - `edit_post_excerpt`
     2907                         *  - `edit_post_status`
     2908                         *  - `edit_post_password`
     2909                         *  - `edit_post_name`
     2910                         *  - `edit_post_modified`
     2911                         *  - `edit_post_modified_gmt`
     2912                         *  - `edit_post_content_filtered`
     2913                         *  - `edit_post_parent`
     2914                         *  - `edit_post_type`
     2915                         *  - `edit_post_mime_type`
    29002916                         *
    29012917                         * @since 2.3.0
    … …  
    29092925                         * Filters the value of a specific post field to edit.
    29102926                         *
    2911                          * The dynamic portion of the hook name, `$field_no_prefix`, refers to
    2912                          * the post field name.
     2927                         * Only applied to post fields with a name which is prefixed with `post_`.
     2928                         *
     2929                         * The dynamic portion of the hook name, `$field_no_prefix`, refers to the
     2930                         * post field name minus the `post_` prefix. Possible filter names include:
     2931                         *
     2932                         *  - `author_edit_pre`
     2933                         *  - `date_edit_pre`
     2934                         *  - `date_gmt_edit_pre`
     2935                         *  - `content_edit_pre`
     2936                         *  - `title_edit_pre`
     2937                         *  - `excerpt_edit_pre`
     2938                         *  - `status_edit_pre`
     2939                         *  - `password_edit_pre`
     2940                         *  - `name_edit_pre`
     2941                         *  - `modified_edit_pre`
     2942                         *  - `modified_gmt_edit_pre`
     2943                         *  - `content_filtered_edit_pre`
     2944                         *  - `parent_edit_pre`
     2945                         *  - `type_edit_pre`
     2946                         *  - `mime_type_edit_pre`
    29132947                         *
    29142948                         * @since 2.3.0
    … …  
    29192953                        $value = apply_filters( "{$field_no_prefix}_edit_pre", $value, $post_id );
    29202954                } else {
     2955                        /**
     2956                         * Filters the value of a specific post field to edit.
     2957                         *
     2958                         * Only applied to post fields not prefixed with `post_`.
     2959                         *
     2960                         * The dynamic portion of the hook name, `$field`, refers to the
     2961                         * post field name. Possible filter names include:
     2962                         *
     2963                         *  - `edit_post_ID`
     2964                         *  - `edit_post_ping_status`
     2965                         *  - `edit_post_pinged`
     2966                         *  - `edit_post_to_ping`
     2967                         *  - `edit_post_comment_count`
     2968                         *  - `edit_post_comment_status`
     2969                         *  - `edit_post_guid`
     2970                         *  - `edit_post_menu_order`
     2971                         * @since
     2972                         */
    29212973                        $value = apply_filters( "edit_post_{$field}", $value, $post_id );
    29222974                }
    … …  
    29372989                         * Filters the value of a specific post field before saving.
    29382990                         *
     2991                         * Only applied to post fields with a name which is prefixed with `post_`.
     2992                         *
    29392993                         * The dynamic portion of the hook name, `$field`, refers to the post
    2940                          * field name.
     2994                         * field name. Possible filter names include:
     2995                         *
     2996                         *  - `pre_post_author`
     2997                         *  - `pre_post_date`
     2998                         *  - `pre_post_date_gmt`
     2999                         *  - `pre_post_content`
     3000                         *  - `pre_post_title`
     3001                         *  - `pre_post_excerpt`
     3002                         *  - `pre_post_status`
     3003                         *  - `pre_post_password`
     3004                         *  - `pre_post_name`
     3005                         *  - `pre_post_modified`
     3006                         *  - `pre_post_modified_gmt`
     3007                         *  - `pre_post_content_filtered`
     3008                         *  - `pre_post_parent`
     3009                         *  - `pre_post_type`
     3010                         *  - `pre_post_mime_type`
    29413011                         *
    29423012                         * @since 2.3.0
    … …  
    29493019                         * Filters the value of a specific field before saving.
    29503020                         *
    2951                          * The dynamic portion of the hook name, `$field_no_prefix`, refers
    2952                          * to the post field name.
     3021                         * Only applied to post fields with a name which is prefixed with `post_`.
     3022                         *
     3023                         * The dynamic portion of the hook name, `$field_no_prefix`, refers to the
     3024                         * post field name minus the `post_` prefix. Possible filter names include:
     3025                         *
     3026                         *  - `author_save_pre`
     3027                         *  - `date_save_pre`
     3028                         *  - `date_gmt_save_pre`
     3029                         *  - `content_save_pre`
     3030                         *  - `title_save_pre`
     3031                         *  - `excerpt_save_pre`
     3032                         *  - `status_save_pre`
     3033                         *  - `password_save_pre`
     3034                         *  - `name_save_pre`
     3035                         *  - `modified_save_pre`
     3036                         *  - `modified_gmt_save_pre`
     3037                         *  - `content_filtered_save_pre`
     3038                         *  - `parent_save_pre`
     3039                         *  - `type_save_pre`
     3040                         *  - `mime_type_save_pre`
    29533041                         *
    29543042                         * @since 2.3.0
    … …  
    29583046                        $value = apply_filters( "{$field_no_prefix}_save_pre", $value );
    29593047                } else {
     3048                        /**
     3049                         * Filters the value of a specific field before saving.
     3050                         *
     3051                         * Only applied to post fields with a name which is prefixed with `post_`.
     3052                         *
     3053                         * The dynamic portion of the hook name, `$field_no_prefix`, refers to the
     3054                         * post field name minus the `post_` prefix. Possible filter names include:
     3055                         *
     3056                         *  - `pre_post_ID`
     3057                         *  - `pre_post_comment_status`
     3058                         *  - `pre_post_ping_status`
     3059                         *  - `pre_post_to_ping`
     3060                         *  - `pre_post_pinged`
     3061                         *  - `pre_post_guid`
     3062                         *  - `pre_post_menu_order`
     3063                         *  - `pre_post_comment_count`
     3064                         *
     3065                         * @since 2.3.0
     3066                         *
     3067                         * @param mixed $value Value of the post field.
     3068                         */
    29603069                        $value = apply_filters( "pre_post_{$field}", $value );
    29613070
    … …  
    29633072                         * Filters the value of a specific post field before saving.
    29643073                         *
     3074                         * Only applied to post fields with a name which is *not* prefixed with `post_`.
     3075                         *
    29653076                         * The dynamic portion of the hook name, `$field`, refers to the post
    2966                          * field name.
     3077                         * field name. Possible filter names include:
     3078                         *
     3079                         *  - `ID_pre`
     3080                         *  - `comment_status_pre`
     3081                         *  - `ping_status_pre`
     3082                         *  - `to_ping_pre`
     3083                         *  - `pinged_pre`
     3084                         *  - `guid_pre`
     3085                         *  - `menu_order_pre`
     3086                         *  - `comment_count_pre`
    29673087                         *
    29683088                         * @since 2.3.0
    … …  
    29803100                         * Filters the value of a specific post field for display.
    29813101                         *
     3102                         * Only applied to post fields with a name which is prefixed with `post_`.
     3103                         *
    29823104                         * The dynamic portion of the hook name, `$field`, refers to the post
    2983                          * field name.
     3105                         * field name. Possible filter names include:
     3106                         *
     3107                         *  - `post_author`
     3108                         *  - `post_date`
     3109                         *  - `post_date_gmt`
     3110                         *  - `post_content`
     3111                         *  - `post_title`
     3112                         *  - `post_excerpt`
     3113                         *  - `post_status`
     3114                         *  - `post_password`
     3115                         *  - `post_name`
     3116                         *  - `post_modified`
     3117                         *  - `post_modified_gmt`
     3118                         *  - `post_content_filtered`
     3119                         *  - `post_parent`
     3120                         *  - `post_type`
     3121                         *  - `post_mime_type`
    29843122                         *
    29853123                         * @since 2.3.0
    … …  
    29933131                        $value = apply_filters( "{$field}", $value, $post_id, $context );
    29943132                } else {
     3133                        /**
     3134                         * Filters the value of a specific post field for display.
     3135                         *
     3136                         * Only applied to post fields name which is *not* prefixed with `post_`.
     3137                         *
     3138                         * The dynamic portion of the hook name, `$field`, refers to the post
     3139                         * field name. Possible filter names include:
     3140                         *
     3141                         *  - `post_ID`
     3142                         *  - `post_comment_status`
     3143                         *  - `post_ping_status`
     3144                         *  - `post_to_ping`
     3145                         *  - `post_pinged`
     3146                         *  - `post_guid`
     3147                         *  - `post_menu_order`
     3148                         *  - `post_comment_count`
     3149                         *
     3150                         * @since 2.3.0
     3151                         *
     3152                         * @param mixed  $value   Value of the unprefixed post field.
     3153                         * @param int    $post_id Post ID
     3154                         * @param string $context Context for how to sanitize the field.
     3155                         *                        Accepts 'raw', 'edit', 'db', 'display',
     3156                         *                        'attribute', or 'js'. Default 'display'.
     3157                         */
    29953158                        $value = apply_filters( "post_{$field}", $value, $post_id, $context );
    29963159                }
    … …  
    30073170                $value = (int) $value;
    30083171        }
    3009 
    30103172        return $value;
    30113173}
Note: See TracChangeset for help on using the changeset viewer.