Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
columbian-chris opened this issue Nov 6, 2019 · 1 comment
Open

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

columbian-chris opened this issue Nov 6, 2019 · 1 comment

Comments

@columbian-chris
Copy link

columbian-chris commented Nov 6, 2019

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
);
@columbian-chris
Copy link
Author

Is there maybe a way to not load the Disqus plugin at all in certain page templates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant