WordPress Error Solved – Warning: Parameter 2 to wp_hide_post_Public :: query_posts_join( ) expected to be a reference

Shop WordPress books on Amazon.

WordPress LogoAfter 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 note of the error message, it should give you a hint 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 just disable the problematic plugin.

In my case, the error was caused by a bit of code 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.

  1. Open class-wp-hide-post-public.php and do a search for &$.
  2. Remove the all & that appear in front of the $ and save your file.
  3. Refresh your website and the problem should be fixed.
  4. If you’re using a caching plugin you may need to force purge your cache and try again.

Apparently, PHP 7.1 doesn’t like & in front of $query parameters in functions.

Check out Garrett Digital for help with SEO or WordPress problems large or small.

Shop WordPress books on Amazon.