get_post_meta not work in php foreach
Question
i have these codes :
foreach ( $ids as $idss ) {
echo get_post_meta($idss, 'IMDB', true);
}
i have search box with Form element that search and find all id ( $ids ) of searched word .
i want to print all $ids ‘s IMDB field !
i can do it on page.PHP of theme !
but i cant do it on header.PHP
i used global $post;
and it didnot worked !
Updates ( answer ) :
i add this line to my code :
require_once( dirname(__DIR__) . '/wp-load.php');
0
php, post-meta
6 years
2016-11-01T19:40:18-05:00
2016-11-01T19:40:18-05:00 0 Answers
87 views
0
Leave an answer