Answers for "setup postdata not working"

PHP
1

setup_postdata not working

global $post; //important
$posts = get_posts($args);
  foreach($posts as $post) { //should be $post not $p etc
    setup_postdata($post);
    the_title();
  }
  wp_reset_postdata();
Posted by: Guest on March-09-2021

Browse Popular Code Answers by Language