Wordpress integration issue

AI-generated summary

In the “Wordpress integration issue” discussion, user terraboss reports a critical error occurring after changing their WordPress site’s subdomain from sandbox.* to www.*. The error, triggered when publishing a new post, involves a warning that the first parameter in discourse.php (line 507) is not an object or existing class, causing header modification failures. terraboss provided the specific code snippet from line 507 where the issue appears to originate, involving property_exists checks on a JSON object. User erlend_sh suggested uninstalling and reinstalling the plugin as a potential fix. However, terraboss confirmed that the error persists even after attempting this solution.

Hello,
I’ve got the following error:

Warning: First parameter must either be an object or the name of an existing class in /www/htdocs/w011e2a4/webdata/wordpress/wp-content/plugins/wp-discourse-0.6.6/lib/discourse.php on line 507

Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/w011e2a4/webdata/wordpress/wp-content/plugins/wp-discourse-0.6.6/lib/discourse.php:507) in /www/htdocs/w011e2a4/webdata/wordpress/wp-admin/post.php on line 242

Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/w011e2a4/webdata/wordpress/wp-content/plugins/wp-discourse-0.6.6/lib/discourse.php:507) in /www/htdocs/w011e2a4/webdata/wordpress/wp-includes/pluggable.php on line 1207

This happens since I’ve changed the subdomain of our WP site from sandbox.… to www.… The issue shows up when publishing a new post.

All the other sites are working probably. I didn’t notice any other issues.

The post by itself is showing this error:

Warning: First parameter must either be an object or the name of an existing class in /www/htdocs/w011e2a4/webdata/wordpress/wp-content/plugins/wp-discourse-0.6.6/lib/discourse.php on line 507

Any clue?

Beginning at line 507, discourse.php

if( property_exists( $json, 'id' ) ) {
  $discourse_id = (int) $json->id;
}

if( isset( $discourse_id ) && $discourse_id > 0 ) {
  add_post_meta( $postid, 'discourse_post_id', $discourse_id, true );
}
  }
} else {
  // for now the updates are just causing grief, leave'em out
  return;
  $url = $options['url'] .'/posts/' . $discourse_id ;
  $post_options = array( 'method' => 'PUT', 'body' => http_build_query( $data ) );
  $result = wp_remote_post( $url, $post_options );
  $json = json_decode( $result['body'] );

  if(isset( $json->post ) ) {
    $json = $json->post;
  }

Have you tried to simply uninstall and reinstall the plugin?

The error is the same.