[WordPress] Load All WordPress Custom Fields via Database Query
<?php | |
function get_the_custom_fields() { | |
global $wpdb; | |
$results = $wpdb->get_results( | |
$wpdb->prepare( | |
" | |
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