_wp_translate_postdata example

case 'password':
                unset( $post_data['sticky'] );
                break;
            case 'private':
                $post_data['post_status']   = 'private';
                $post_data['post_password'] = '';
                unset( $post_data['sticky'] );
                break;
        }
    }

    $post_data = _wp_translate_postdata( true, $post_data );
    if ( is_wp_error( $post_data ) ) {
        wp_die( $post_data->get_error_message() );
    }
    $translated = _wp_get_allowed_postdata( $post_data );

    // Post formats.     if ( isset( $post_data['post_format'] ) ) {
        set_post_format( $post_id$post_data['post_format'] );
    }

    $format_meta_urls = array( 'url', 'link_url', 'quote_source_url' );
    
'filename' => esc_html( $_FILES['async-upload']['name'] ),
                    ),
                )
            );

            wp_die();
        }
    } else {
        $post_id = null;
    }

    $post_data = ! empty( $_REQUEST['post_data'] ) ? _wp_get_allowed_postdata( _wp_translate_postdata( false, (array) $_REQUEST['post_data'] ) ) : array();

    if ( is_wp_error( $post_data ) ) {
        wp_die( $post_data->get_error_message() );
    }

    // If the context is custom header or background, make sure the uploaded file is an image.     if ( isset( $post_data['context'] ) && in_array( $post_data['context'], array( 'custom-header', 'custom-background' ), true ) ) {
        $wp_filetype = wp_check_filetype_and_ext( $_FILES['async-upload']['tmp_name']$_FILES['async-upload']['name'] );

        if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) {
            echo wp_json_encode(
                
Home | Imprint | This part of the site doesn't use cookies.