Make WordPress Core

Ticket #28745: wxr_export_skip_commentmeta.patch

File wxr_export_skip_commentmeta.patch, 1.2 KB (added by cfinke, 12 years ago)
  • wp-admin/includes/export.php

     
    468468                        <wp:comment_parent><?php echo $c->comment_parent; ?></wp:comment_parent>
    469469                        <wp:comment_user_id><?php echo $c->user_id; ?></wp:comment_user_id>
    470470<?php           $c_meta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID ) );
    471                         foreach ( $c_meta as $meta ) : ?>
     471                        foreach ( $c_meta as $meta ) :
     472                                /**
     473                                 * Filter whether to selectively skip comment meta used for WXR exports.
     474                                 *
     475                                 * Returning a truthy value to the filter will skip the current meta
     476                                 * object from being exported.
     477                                 *
     478                                 * @param bool   $skip     Whether to skip the current comment meta. Default false.
     479                                 * @param string $meta_key Current meta key.
     480                                 * @param object $meta     Current meta object.
     481                                 */
     482                                if ( apply_filters( 'wxr_export_skip_commentmeta', false, $meta->meta_key, $meta ) ) {
     483                                        continue;
     484                                }
     485                        ?>
    472486                        <wp:commentmeta>
    473487                                <wp:meta_key><?php echo $meta->meta_key; ?></wp:meta_key>
    474488                                <wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value>