0

I have a multi-purpose theme, which allow to download complete demo site content/wordpress. Normally (www.example.com) it's perfect and run all demo request, last time i install a new wordpress multisite network and enabled as Network theme.

Fatal error: Cannot use object of type WP_Error as array in /home1/user/public_html/example.com/wp-content/themes/mytheme/functions/importer/import.php on line 491

Line number 491 in import.php looks like this

                            if( $response['response']['code'] == 401 ){

Here is complete block of php code from line number 489 to 511

                    <?php 
                    if( $test_error ){  
                        if( $response['response']['code'] == 401 ){
                            // 401 Unauthorized | HTTP Basic Authentication

                            echo '<tr class="row-401">';

                                echo '<th scope="row">';
                                    echo '<label for="import">Login details</label>';
                                echo '</th>';

                                echo '<td>';
                                    echo '<p class="description">Looks like your server uses HTTP Basic Authentication, please enter your login details:</p>';
                                    echo '<label for="args_login">Login</label>';
                                    echo '<input type="text" name="args_login" />';
                                    echo '<label for="args_pass">Password</label>';
                                    echo '<input type="password" name="args_pass" />';
                                echo '</td>';

                            echo '</tr>';
                        }
                    }
                ?>

Here is details of wordpress network: Subdomains not enabled, Network Enables "beTheme", everytimes asked from support, they refer to hosting administrator and hostgator support couldn't answer about MultiSite. btw I'm sure they are not blocking any request, as i mentioned this theme works fine with normal wordpress website. I am confused what going on in Multisite Network or what should be exact solution for this? My apologies if there is already this questions asked but i couldn't find anywhere question/answer.

1
  • someone mentioned on muffin group support, add add_filter( 'http_api_transports', function() { return array( 'streams' ); }); in last row of wp-config.php but didn't work for me. I got error in syntax Commented Apr 4, 2016 at 20:41

1 Answer 1

0

This error means $response isn't returning the array you expect but a wordpress error object. Try

if( is_wp_error( $response ) ) {
    echo $response->get_error_message();
}

and see what you get.

11
  • let me try this one. Commented Apr 4, 2016 at 20:48
  • I just update that snippet - didn't replace a couple of variables correctly
    – dg4220
    Commented Apr 4, 2016 at 20:49
  • now "SSL connect error Login details Looks like your server uses HTTP Basic Authentication, please enter your login details:" asking and when i click on import receive another error functions/importer/import.php on line 133 Commented Apr 4, 2016 at 21:03
  • What's the error on that line?
    – dg4220
    Commented Apr 4, 2016 at 21:07
  • complete block of next error, there are 4 blocks for importing, menu, options, widgets importing.etc /** * Import | Menu - Locations * */ function import_menu_location( $file = 'menu.txt' ){ $file_path = LIBS_URI . '/importer/demo/'. $file; $file_data = $this->wp_remote_get_auth( $file_path ); $data = unserialize( base64_decode( $file_data['body'])); $menus = wp_get_nav_menus(); foreach( $data as $key => $val ){ foreach( $menus as $menu ){ if( $val && $menu->slug == $val ){ $data[$key] = absint( $menu->term_id ); } } } // print_r($data); set_theme_mod( 'nav_menu_locations', $data ); } Commented Apr 4, 2016 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.