• Ok so looks like the dev for this plugin maybe too busy to fix these issue. So here’s the fix if anyone interested. I didn’t spend too much time on the media so no date range. Make sure you back up before any editing.

    Menu and media fix. You will need to edit 3 files in the plugin include folder.
    class-functions.php:
    Find around line 50 add these two line below it

    //Modified by Be4Real	prepare nav menu item
    $where = $wpdb->prepare( "{$wpdb->posts}.post_type = %s", 'nav_menu_item' );
    // Modified by Be4Real -grab a snapshot of post IDs, just in case it changes during the export
    $post_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} $join WHERE $where" );

    find around line 384:

    function wxr_nav_menu_terms() {
    		$nav_menus = wp_get_nav_menus();
    		if ( empty( $nav_menus ) || ! is_array( $nav_menus ) )
    			return;
    
    		foreach ( $nav_menus as $menu ) {
    			echo "\t<wp:term><wp:term_id>{$menu->term_id}</wp:term_id><wp:term_taxonomy>nav_menu</wp:term_taxonomy><wp:term_slug>{$menu->slug}</wp:term_slug>";
    			wxr_term_name( $menu );
    			echo "</wp:term>\n";
    		}
    	}

    Add these below the last }.

    //Modified by Be4Real
    	function wxr_nav_menu_item_terms_and_posts( &$post_ids ) {
    		
    		$posts_to_add = array();
    		
    		foreach( $post_ids as $post_id ) {
    			
    			if( ($type = get_post_meta( $post_id, '_menu_item_type', true ) ) == 'taxonomy' ) {
    				$term = get_term( get_post_meta( $post_id, '_menu_item_object_id', true ), ($tax = get_post_meta( $post_id, '_menu_item_object', true )) );
    				
    				echo "\t<wp:term><wp:term_id>{$term->term_id}</wp:term_id><wp:term_taxonomy>{$tax}</wp:term_taxonomy><wp:term_slug>{$term->slug}</wp:term_slug>";
    				wxr_term_name( $term );
    				echo "</wp:term>\n";
    			} elseif( $type == 'post_type' && in_array( get_post_meta( $post_id, '_menu_item_object', true ), array( 'post', 'page' ) ) ) {
    
    				$posts_to_add[] = get_post_meta( $post_id, '_menu_item_object_id', true );
    			}
    			
    			
    		}
    		$post_ids = array_merge( $posts_to_add, $post_ids );
    	}//End Mod

    Find around line 471
    <?php if ( in_array( 'menus', $args['content'] ) ) wxr_nav_menu_terms(); ?>
    REPLACE with

    <?php wxr_nav_menu_terms(); ?>
    <?php wxr_nav_menu_item_terms_and_posts( $post_ids ) ?>

    Class-export-plus.php
    Find around line 163

    if ( $_GET['post_status'] ) {
    			$args['status'] = $_GET['post_status'];
    		}

    ADD below the last }.

    //Modified by Be4Real for Media
    if ( 'attachment' == $_GET['content'] ) {
    $args['content'] = 'attachment';
    }

    export-template.php
    Find around line 62
    <p><label><input type="checkbox" name="content[]" value="menus" checked="checked" /> <?php _e( 'Menus', 'export-plus' ); ?></label></p>
    REPLACE with these:

    <p><label><input type="checkbox" name="content[]" value="nav_menu_item" checked="checked" /> <?php _e( 'Menus', 'export-plus' ); ?></label></p>
    
    <p><label><input type="checkbox" name="content[]" value="attachment" checked="checked" /> <?php _e( 'Media', 'export-plus' ); ?></label></p>

    That’s it. Enjoy

    • This topic was modified 5 years, 8 months ago by be4real.
    • This topic was modified 5 years, 8 months ago by be4real.
  • The topic ‘Menu and Media fixed’ is closed to new replies.