Fatal error: Uncaught Error: Function name must be a string in C: \ OpenServer \ domains \ akto \ wp-content \ themes \ akto \ functions.php: 230
function getReviews () {
$ args = array (
'orderby' = & gt; 'date',
'order' = & gt; 'ASC',
'post_type' = & gt; 'reviews'
);
$ reviews = [];
foreach ($ get_posts ($ args) as $ post) {
$ review = get_fields ($ post- & gt; ID);
$ reviews [] = $ review;
}
return $ reviews;
}
print_r (getReviews ());
Answer 1
get_posts
is a wp function, and I accidentally declared it a variable.