Home php Error - Function name must be a string in

Error – Function name must be a string in

Author

Date

Category

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.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions