• 0
Sign in to follow this  
Manoodin

Como visualizo valor de poste de meta key de tabela?

Question

Como visualizo valor de poste, de meta_key de tabela? Tenho que recuperar um valor de um poste que esta em uma meta_key em uma tabela. Eu acho que para poder importa os valores da meta_key certos, tenho que importa pelo test_id que é o id, que esta na tabela. como faço isso?

<?php
    global  $wpdb;
$id = get_the_ID(); 
$option5 = $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: $option5";
?>

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this