WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #35316, comment 11


Ignore:
Timestamp:
01/08/2016 03:16:18 PM (4 years ago)
Author:
ocean90
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #35316, comment 11

    initial v1  
    104104
    105105[attachment:35316.patch] encodes the keywords.
     106
     107----
     108
     109Until this gets fixed in core you can use the following function:
     110{{{#!php
     111<?php
     112function trac35316_fix_iptc_keywords_encoding( $meta ) {
     113        foreach ( $meta['keywords'] as $key => $keyword ) {
     114                if ( ! seems_utf8( $keyword ) ) {
     115                        $meta['keywords'][ $key ] = utf8_encode( $keyword );
     116                }
     117        }
     118
     119        return $meta;
     120}
     121add_filter( 'wp_read_image_metadata', 'trac35316_fix_iptc_keywords_encoding' );
     122}}}