Export: Add wxr_export_skip_commentmeta filter to match the _postmeta filter.

props cfinke.
fixes #28745.


git-svn-id: https://develop.svn.wordpress.org/trunk@29573 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2014-08-22 01:47:59 +00:00
parent 0f83364811
commit d395f64117
1 changed files with 17 additions and 1 deletions

View File

@ -473,7 +473,23 @@ function export_wp( $args = array() ) {
<wp:comment_parent><?php echo $c->comment_parent; ?></wp:comment_parent>
<wp:comment_user_id><?php echo $c->user_id; ?></wp:comment_user_id>
<?php $c_meta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID ) );
foreach ( $c_meta as $meta ) : ?>
foreach ( $c_meta as $meta ) :
/**
* Filter whether to selectively skip comment meta used for WXR exports.
*
* Returning a truthy value to the filter will skip the current meta
* object from being exported.
*
* @since 4.0.0
*
* @param bool $skip Whether to skip the current comment meta. Default false.
* @param string $meta_key Current meta key.
* @param object $meta Current meta object.
*/
if ( apply_filters( 'wxr_export_skip_commentmeta', false, $meta->meta_key, $meta ) ) {
continue;
}
?>
<wp:commentmeta>
<wp:meta_key><?php echo $meta->meta_key; ?></wp:meta_key>
<wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value>