Make WordPress Core


Ignore:
Timestamp:
04/08/2014 07:40:30 AM (11 years ago)
Author:
DrewAPicture
Message:

Clarify documentation for hooks in sanitize_post_field().

  • edit_post_{$field} pairs with edit_{$field}
  • pre_post_{$field} pairs with pre_{$field}
  • post_{$field} pairs with {$field}

As the above pairs' docs are unnecessarily duplicative, the second sets of docs have been removed. Also, the "duplicates" are purposely not marked as such in this case as the hook names differ. Also remove @deprecated tags mistakenly left in in [28041].

See #25376.

File:
1 edited

Legend:

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

    r28041 r28042  
    20122012             * Filter the value of a specific post field to edit.
    20132013             *
    2014              * The dynamic portion of the hook name, $field, refers to the prefixed
    2015              * post field name. For example, 'post_title'.
     2014             * The dynamic portion of the hook name, $field, refers to the post field name.
    20162015             *
    20172016             * @since 2.3.0
     
    20262025             *
    20272026             * The dynamic portion of the hook name, $field_no_prefix, refers to
    2028              * the post field name with no prefix. For example, 'title' instead
    2029              * of 'post_title'.
     2027             * the post field name.
    20302028             *
    20312029             * @since 2.3.0
    2032              * @deprecated 2.3.0 Use "edit_post_$field" instead.
    20332030             *
    20342031             * @param mixed $value   Value of the post field.
     
    20372034            $value = apply_filters( "{$field_no_prefix}_edit_pre", $value, $post_id );
    20382035        } else {
    2039 
    2040             /**
    2041              * Filter the value of a specific post field to edit.
    2042              *
    2043              * The dynamic portion of the hook name, $field, refers to the un-prefixed
    2044              * post field. For example, 'title' instead of 'post_title'.
    2045              *
    2046              * @since 2.3.0
    2047              *
    2048              * @param mixed $value   Value of the un-prefixed post field.
    2049              * @param int   $post_id Post ID.
    2050              */
    20512036            $value = apply_filters( "edit_post_{$field}", $value, $post_id );
    20522037        }
     
    20642049
    20652050            /**
    2066              * Filter the value of a specific field before saving.
     2051             * Filter the value of a specific post field before saving.
    20672052             *
    2068              * The dynamic portion of the hook name, $field, refers to the
    2069              * prefixed post field name. For example, 'post_title'.
     2053             * The dynamic portion of the hook name, $field, refers to the post field name.
    20702054             *
    20712055             * @since 2.3.0
     
    20792063             *
    20802064             * The dynamic portion of the hook name, $field_no_prefix, refers
    2081              * to the un-prefixed post field name. For example, 'title' instead
    2082              * of 'post_title'.
     2065             * to the post field name.
    20832066             *
    20842067             * @since 2.3.0
    2085              * @deprecated 2.3.0 Use "pre_post_{$field}" instead.
    20862068             *
    20872069             * @param mixed $value Value of the post field.
     
    20892071            $value = apply_filters( "{$field_no_prefix}_save_pre", $value );
    20902072        } else {
     2073            $value = apply_filters( "pre_post_{$field}", $value );
    20912074
    20922075            /**
    2093              * Filter the value of a specific field before saving.
     2076             * Filter the value of a specific post field before saving.
    20942077             *
    2095              * The dynamic portion of the hook name, $field, refers to the un-prefixed
    2096              * post field name. For example, 'title' instead of 'post_title'.
     2078             * The dynamic portion of the hook name, $field, refers to the post field name.
    20972079             *
    20982080             * @since 2.3.0
     
    21002082             * @param mixed $value Value of the post field.
    21012083             */
    2102             $value = apply_filters( "pre_post_{$field}", $value );
    2103 
    2104             /**
    2105              * Filter the value of a specific field before saving.
    2106              *
    2107              * The dynamic portion of the hook name, $field, refers to the un-prefixed
    2108              * post field name. For example, 'title' instead of 'post_title'.
    2109              *
    2110              * @since 2.3.0
    2111              * @deprecated 2.3.0 Use "pre_post_{$field}" instead.
    2112              *
    2113              * @param mixed $value Value of the post field.
    2114              */
    21152084            $value = apply_filters( "{$field}_pre", $value );
    21162085        }
     
    21232092             * Filter the value of a specific post field for display.
    21242093             *
    2125              * The dynamic hook name, $field, refers to the prefixed post field
    2126              * name. For example, 'post_title'.
     2094             * The dynamic portion of the hook name, $field, refers to the post field name.
    21272095             *
    2128              * @since
     2096             * @since 2.3.0
    21292097             *
    21302098             * @param mixed  $value   Value of the prefixed post field.
     
    21362104            $value = apply_filters( $field, $value, $post_id, $context );
    21372105        } else {
    2138 
    2139             /**
    2140              * Filter the value of a specific post field for display.
    2141              *
    2142              * The dynamic portion of the hook name, $field, refers to the un-prefixed
    2143              * post field name. For example, 'title' instead of 'post_title'.'
    2144              *
    2145              * @since
    2146              *
    2147              * @param mixed  $value   Value of the un-prefixed post field.
    2148              * @param int    $post_id Post ID.
    2149              * @param string $context Context for how to sanitize the field. Possible
    2150              *                        values include 'raw', 'edit', 'db', 'display',
    2151              *                        'attribute' and 'js'.
    2152              */
    21532106            $value = apply_filters( "post_{$field}", $value, $post_id, $context );
    21542107        }
Note: See TracChangeset for help on using the changeset viewer.