function add_predefined_custom_field_names( $query ) {
$predefined = array(
\'www.cyberxoft.com\'
);
global $table_prefix;
$query = preg_replace(\'/[\\r\\n\\t]/\', \' \', $query); //minify by removing all tabs and line breaks
$query = preg_replace(\'/\\s+/\', \' \', $query); //minify by replacing spaces, tabs and carriages to single space
//SELECT meta_key FROM wp_postmeta GROUP BY meta_key HAVING meta_key NOT LIKE \'\\\\_%\' ORDER BY meta_key LIMIT 30
$pattern = ("/SELECT meta_key FROM ".$table_prefix."postmeta/i");
if( preg_match($pattern, $query) ) {
$keys = \'\';
foreach($predefined as $key){$keys .= (" UNION SELECT \'$key\' AS meta_key");}
$query = preg_replace(\'/SELECT/i\', \'SELECT meta_key FROM (SELECT\', $query);
$query = preg_replace(\'/FROM wp_postmeta/i\', (\'FROM wp_postmeta\'.$keys), $query);
$query = preg_replace(\'/ GROUP BY/i\', \')t GROUP BY\', $query);
}
return $query;
}
add_filter(\'query\', \'add_predefined_custom_field_names\');
只需在主题函数的任何位置添加上述代码。php。添加上述代码后,它会添加“www.cyberxoft”。com”作为要选择的选项之一,添加到下拉列表中。
如果你能看到它,那么只需替换“www.cyberxoft”。使用您所需的字段名进行com,并刷新管理页面,当您看到发生这种情况时,请继续添加任意数量的内容,但请记住,只能查看30个,因为这是为其设置的默认限制。
享受