• For some time I have been struggling with exporting just those posts with a certain tag. The export never had any posts, i.e. it claimed no post satisfied the post_tag. However, I was certain that was not the case.

    After much searching and attempting the patches at http://core.trac.wordpress.org/ticket/15197 (gutting filtering for now is not an option for me.), I dug a bit into the tables and I believe that wp-admin/includes/export.php has an error around Line 67 in export_wp()

    if ( $taxonomy && is_array( $taxonomy ) ) {
    		foreach ( $taxonomy as $term_id ) {
    			if ( $term_id != 'all' )
    // incorrect  				$where .= $wpdb->prepare( "AND ID IN (SELECT object_id FROM $wpdb->term_relationships WHERE term_id = %d) ", intval($term_id) );
    //corrected version with tables joined on term_taxonomy key
    				$where .= $wpdb->prepare( "AND ID IN (SELECT object_id FROM $wpdb->term_relationships left join $wpdb->term_taxonomy on ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) WHERE term_id = %d) ", intval($term_id) );

    I am a noob, so posting this for others to check out before submitting it as a ticket.

  • The topic ‘Export Bug with Taxonomies’ is closed to new replies.