Chapter in this post:
For me it happens every now and then that companies that have one book a sponsored postwant to read beforehand what I have written about your product or service. This can of course be solved by simply copying the text into an email and sending it to the customer. However, I don't find the solution so nice, because I put a lot of effort into photographs and screenshots and I want the customers to be able to see the entire article including all images.
The programmer Dominik Schilling has a small but nice plugin for this purpose called Public Post Preview or to German "Public preview for contributions" developed that allows access to the preview of an article for a limited time via a specific URL. The article can and should be saved as a draft so that it is not already publicly available.
To activate the public preview, simply put a checkmark next to "Activate public preview" in the publish box in the WordPress editor (see screenshot above). Now a small text field opens there (see screenshot below) with an Internet address that can be copied and then transmitted to any person via email, WhatsApp or otherwise.
But be careful: Anyone who gets this URL can access the pre-release version of the blog post. The good news: WordPress tags every preview page with a robots meta tag that tells search engines not to index the page. This prevents such a URL from suddenly appearing in the Google search even though the post has not actually been approved yet.
Who - like me - the SEO plugin Yoast SEO uses, who will be surprised when he looks at the source text of the preview article. Both WordPress and Yoast SEO each place a robots meta tag in the HTML - Yoast SEO with the value "index, follow" and WordPress itself with "noindex, follow". These are of course contradicting instructions for Google and other search engines and it is difficult to say what the bot will do when it reads such a URL.
I haven't found a trick yet to tell Yoast SEO to always print "noindex" on preview blog posts. However, since the preview links are only valid for 48 hours anyway and then a 404 error occurs (or a redirect to the published article), indexing is only temporary anyway.
At this point I would like to introduce you to a little hack that I made in the source code of the Public Post Preview plugin. The 48 hours that a preview link remains active is often set too short in practice. I often get the answer that the URL stopped working because it took three or four days for customers to take care of viewing the article.
To extend the time to a week, open the plugin directory and then select the file "public-post-preview.php". In the text editor, look for this command at line 574 in the code:
$nonce_life = apply_filters( 'ppp_nonce_life', 60 * 60 * 48 ); // 48 hours
We change this line as follows:
$nonce_life = apply_filters( 'ppp_nonce_life', 60 * 60 * 24 * 7 ); // 1 week
The last number in the invoice now indicates the number of days that the preview URL should be valid. You just have to remember that this change will be overwritten every time the plugin is updated.
Of course, it would be great if there was a settings page for the plugin in the WordPress admin area, where you can set the time yourself, but unfortunately my programming knowledge is not enough. Maybe at some point Dominik will have the muse to incorporate this feature.
Jens has been running the blog since 2012. He appears as Sir Apfelot for his readers and helps them with problems of a technical nature. In his free time he drives electric unicycles, takes photos (preferably with his iPhone, of course), climbs around in the Hessian mountains or hikes with the family. His articles deal with Apple products, news from the world of drones or solutions for current bugs.