My friend made a xml generator plugin what is owrking fine with WP 3.5, but i need to update for 4.2.2 (cause the security) and the plugins now said 'No database selected', but the informations / datas in wp-config.php file is correct.
The plugin:
<?php
require_once('../../../wp-config.php');
if(file_exists('../../../wp-config.php')){
echo 'Database is exist';
}else{
echo 'n';
}
$xmlFile = plugin_dir_path( __FILE__ ).'test.xml';
unset($sitemapContent);
$sitemapContent = '<?xml version="1.0" encoding="UTF-8" ?>'."\n";
$sitemapContent .= '<products>'."\n";
$getProductsRes = mysql_query("SELECT * FROM wp_posts WHERE post_type = 'product' AND post_status = 'publish' AND post_parent = '0'");
if($getProductsRes){
}else{
echo mysql_error();
}
The 'Database is exist' is visible, but the query not executed.
EDIT: Oh, i found the Solution. In WP 3.9 and heighter not supported mysql_query anymore: Link