Make WordPress Core

Ticket #52518: wp-includes--posts.php.diff

File wp-includes--posts.php.diff, 1.2 KB (added by Tkama, 4 years ago)

/wp-includes/post.php

  • wp-includes/post.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    23862386 * @return mixed Sanitized value.
    23872387 */
    23882388function sanitize_post_field( $field, $value, $post_id, $context = 'display' ) {
     2389
    23892390        $int_fields = array( 'ID', 'post_parent', 'menu_order' );
    23902391        if ( in_array( $field, $int_fields, true ) ) {
    23912392                $value = (int) $value;
     
    23982399                return $value;
    23992400        }
    24002401
    2401         if ( 'raw' === $context ) {
    2402                 return $value;
    2403         }
    2404 
    24052402        $prefixed = false;
    24062403        if ( false !== strpos( $field, 'post_' ) ) {
    24072404                $prefixed        = true;
    24082405                $field_no_prefix = str_replace( 'post_', '', $field );
    24092406        }
    24102407
     2408        if ( 'raw' === $context ) {
     2409
     2410                if( ! $prefixed ){
     2411                        $field = "post_{$field}";
     2412                }
     2413
     2414                /** This filter is documented in wp-includes/post.php */
     2415                $value = apply_filters( "{$field}", $value, $post_id, $context );
     2416
     2417                return $value;
     2418        }
     2419
    24112420        if ( 'edit' === $context ) {
    24122421                $format_to_edit = array( 'post_content', 'post_excerpt', 'post_title', 'post_password' );
    24132422