Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
[WordPress] Load All WordPress Custom Fields via Database Query
function get_the_custom_fields() {
global $wpdb;
$results = $wpdb->get_results(
SELECT meta_key, meta_value
FROM $wpdb->postmeta
WHERE meta_key REGEXP '%s'
", '^[_]'
return $results;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment