Skip to content

"Undefined property" error on non-post pages #77

@columbian-chris

Description

@columbian-chris

The plugin works normally in my "post" type pages as expected, but it seems as though it's trying to load on pages it shouldn't. I would think that something like Disqus_Public::dsq_can_load or some other means would be communicating not to load on these pages because there's no $post object (these pages do not have the "post" post_type or call for a WP comments module that I can see anywhere). The notices thrown:

Trying to get property 'ID' of non-object in /vagrant/columbian/wp-content/plugins/disqus-comment-system/public/class-disqus-public.php on line 32
Trying to get property 'guid' of non-object in /vagrant/columbian/wp-content/plugins/disqus-comment-system/public/class-disqus-public.php on line 32

I slapped a bandaid on it to prevent this error from happening by creating a false $post object:

$post = (object) array(
	'ID' => null,
	'post_status' => null,
	'comment_status' => null,
	'post_type' => null,
	'guid' => null
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions