Shop WordPress books on Amazon.
After upgrading from PHP version 7.0 to 7.1 on my WordPress website hosted with DreamHost, I received the error message below above the header on my website.
Warning: Parameter 2 to wp_hide_post_Public::query_posts_join() expected to be a reference, value given in /home/xyz_vps/nafzinger.com/wp-includes/class-wp-hook.php on line 298
The solution
If you’re not using the WP Hide Post plugin, make a note of the error message, it should give you a hint of what plugin is causing the issue. In the case above, my hint was Parameter 2 to wp_hide_post_Public::query_posts_join(). You can also disable the problematic plugin.
Some code caused the error in the WP Hide Post plugin. I fixed it by connecting to my server via SFTP, then navigating to the WP Hide Post plug-in directory, as shown below.
/wp-content/plugins/wp-hide-post/public/class-wp-hide-post-public.php
- Open class-wp-hide-post-public.php and search &$.
- Remove the all & that appear before the $ and save your file.
- Refresh your website, and the problem should be fixed.
- If you’re using a caching plugin, you may need to force-purge your cache and try again.
PHP 7.1 doesn’t like & in front of $query parameters in functions.
Use Garrett Digital for help with SEO or WordPress problems, large or small.
This was very helpful and saved me a ton of time digging to figure this out… Thank you! 🙂
Thanks for the solution!
I’m getting that error in a different file that has no &$ in it
myself as well
Thanks, man. It was really helpful.
Thank you so much, this really helped me hours browsing and searching
Perfect. Thank you, this worked for me.
THX many a lot! I had only one &$ in plugin code
THANK YOU
Thank you a lot
Merci
Vous m’avez sauvé la vie. Thank you
THANK YOU
This is most helpful. If I have found this post earlier, it would have saved me the time locating the problematic code is. I found it but I had to trace WP HIde Post’s modules. It took some time to locate function query_posts_join().
After searching and wasting on time on Youtube & Google.. finally i got solution from this page.. Thanks a lot.
Thanks mister that did it, thank you very much!!!!
Thanx alot – saved me tons of time
Just found the same issue on a custom search plugin and you helped me debug my own thing, lol cheers 🙂