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.
1 Answer
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>';
}
);
}
);
});
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.