1

One of my client has lost all of his WordPress hosting details. The only thing he/she remembers is the WordPress dashboard's password. Is there a way I can see wp-config file from WordPress dashboard so I can examine where must the database and files be present? Thanks.

3
  • It's not possible to view wp-config details from admin panel. Your client lost his hosting details then contact hosting company. They will provide access details. There should not be any problem unless your client did not own hosting.
    – Robert hue
    Oct 16, 2015 at 7:40
  • 1
    @Roberthue: I tried WP Config file editor and it showed me the items of config.php file.
    – user2238
    Oct 16, 2015 at 7:42
  • OK. it appears you found the solution.
    – Robert hue
    Oct 16, 2015 at 7:43

1 Answer 1

3

You could create a plugin for a dashboard widget, zip, upload and activate it.

Example:

<?php # -*- coding: utf-8 -*-
/**
 * Plugin Name: Configuration Dashboard Widget
 * Description: Show the current installation path and the content of the <code>wp-config.php</code>.
 * Version:     16.10.15
 * Required:    4.0
 * Author:      Thomas Scholz
 * Author URI:  http://toscho.de
 * License:     MIT
 * License URI: http://www.opensource.org/licenses/mit-license.php
 */

add_action( 'wp_loaded', function() {

    current_user_can( 'update_core' ) && add_action(
        'wp_dashboard_setup',
        function() {
            wp_add_dashboard_widget(
                'config_widget',
                'Configuration',
                function() {

                    $wp_config = FALSE;
                    if ( is_readable( ABSPATH . 'wp-config.php' ) )
                        $wp_config = ABSPATH . 'wp-config.php';
                    elseif ( is_readable( dirname( ABSPATH ) . '/wp-config.php' ) )
                        $wp_config = dirname( ABSPATH ) . '/wp-config.php';

                    if ( $wp_config )
                        $code = esc_html( file_get_contents( $wp_config ) );
                    else
                        $code = 'wp-config.php not found';

                    print '<pre class="code" style="overflow: scroll;max-height: 20em"
                            >Installation path: ' . ABSPATH
                          . "\n\n"
                          . $code
                          . '</pre>';
                }
            );
        }
    );
});

Your Answer

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