I'm running some code through phpStorm and am getting an error:

Method 'post_title' not found in class. 

at this line:

echo $post->post_title();

Is that phpStorm getting things wrong or am I accessing post_title incorrectly?

  • Can you provide more information? How do you get the $post object? – cybmeta Apr 20 '15 at 18:50

Two lines of code could hide many things but I find an error: post_title is an attribute and not a method.

echo $post->post_title;

Reference: https://codex.wordpress.org/Class_Reference/WP_Post

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.