How do I view post value, table meta_key? I have to retrieve a value from a post that is in a meta_key in a table. I think that in order to import the correct meta_key values, I have to import the test_id which is the id, which is in the table. how do I do that? Thanks in advance. :)
<?php
global $wpdb;
$id = get_the_ID(); // this only works with standard post loops
$option = $wpdb->get_var( $wpdb->prepare("SELECT meta_value FROM wp_table_test WHERE meta_key = 'test_options' AND test_id = '%d'", $id));
echo "Meta key value for post ID $id: $option";
?>
Sorry bad english