I'm not too good with PHP, so I'm having trouble with some code that is supposed to update the wp_posts table. The problem is that when I try to save it, WP deactivates the plugin saying there's a syntax error in the following bit of code:

global $wpdb;
$dbresult = $wpdb->update($wpdb->post, ['post_title' => 'Test Title', 'post_content' => 'Test Content', 'group_access' => $group_access, 'tag_list' => $tag_list], ['ID' => 12095])) :
if (false === $dbresult) {
    echo 'An error occurred wile updating...');$errors = $post_id->get_error_messages();

I believe it would work if I could figure out what the syntax error was.

1 Answer 1


you've got a simple typo, it should read

$dbresult = $wpdb->update($wpdb->posts, ...) ;

that is, $wpdb->posts with a 's', instead of `$wpdb->post'.

  • Good catch on the missing s from posts. My syntax had several errors, apparently. Just looking at the same thing for too long.
    – user38365
    Mar 4, 2017 at 23:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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