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

Fix warning when accessing a 404 page #159

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

8ctopus
Copy link

@8ctopus 8ctopus commented Jan 31, 2023

@lesterchan
Copy link
Owner

Why will this cause an issue on the 404 page? This seems to be a site specific issue. Not closing it because I think there is room for discussions for this

@8ctopus
Copy link
Author

8ctopus commented Feb 1, 2023

@lesterchan When you reach a 404 page, do the WP-PostRatings js and css load or not? In my case, they do load and that causes the problem. With this PR, the problem disappears.

@lesterchan
Copy link
Owner

Yeap they do load, I think it is your theme issue though, it works on my end with 404, https://lesterchan.net/wordpress/asdasdasdadsd

@8ctopus
Copy link
Author

8ctopus commented Feb 2, 2023

Do you not get any warnings in your php logs?

@lesterchan
Copy link
Owner

lesterchan commented Feb 2, 2023

Nope, my variables in the JS got loaded correctly, so that is why I say it is a theme issue, you can view source and see. In the #155, the line you pointing to is the config and it is global, there is no way it doesn't load on 404 page.

My guess is some theme or plugin is trying to do optimization on 404 pages and that breaks the plugin.

<script id='wp-postratings-js-extra'>
var ratingsL10n = {"plugin_url":"https:\/\/lesterchan.net\/wordpress\/content\/plugins\/wp-postratings","ajax_url":"https:\/\/lesterchan.net\/wordpress\/core\/wp-admin\/admin-ajax.php","text_wait":"Please rate only 1 item at a time.","image":"stars_crystal","image_ext":"gif","max":"5","show_loading":"0","show_fading":"0","custom":"0"};
var ratings_mouseover_image=new Image();ratings_mouseover_image.src="https://lesterchan.net/wordpress/content/plugins/wp-postratings/images/stars_crystal/rating_over.gif";;
</script>

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

Successfully merging this pull request may close these issues.

2 participants