Reputation: 10696
I have created some custom field
- the custom field is displayed correctly in the WordPress admin section but I cannot find them in the database.
Any idea where custom field are saved? I could not find my custom field in the post data in wp_posts
table.
Upvotes: 2
Views: 10914
Reputation: 597
Custom field data saved in the wp_postmeta table. Best way to access custom field is using wordpress built-in functions.
for example:
<?php
$mykey_values = get_post_custom_values('my_key');
foreach ( $mykey_values as $key => $value ) {
echo "$key => $value ('my_key')<br />";
}
?>
0 => First value ('my_key')
1 => Second value ('my_key')
2 => Third value ('my_key')
You will get more information about accessing custom field in this link: http://codex.wordpress.org/Custom_Fields
Upvotes: 6