Hi Michael,
Thank you for your help with this. Yes I am using the latest version of Yoast Version 16.1.1. I am just password protecting it with the default WordPress functionality – by setting the visibility of the post to password protected. No other plugins are used for that functionality.
I do understand not wanting to scrape a protected post’s content for images (which was the issue in the GitHub post as I understand it). However, if the user has explicitly set data for Facebook on that post I would expect that to be displayed. The only reason to put any content in those fields is if we want it shared to Facebook – there’s really no good reason for me to manually fill those fields with anything proprietary. Even defaulting to the generic content from the main Yoast settings page(if set) also seems preferable to replacing the Facebook content with just “this cannot be displayed” – since that’s not going to get me a lot of clicks.
I did use the code from this tutorial which has enabled me to at least get the description tag populated for Facebook, but I don’t know how to plug in to the Yoast functionality to get the og:image tag set up too.
I’m happy to write my own code to fix this if you can point me in the right direction for how to override the blanking out of the password protected post’s Facebook data. I know it’s a weird use case – usually password protected posts aren’t really meant to be shared so most users probably aren’t too worried about this. I’m posting this particular post in some specific Facebook groups with the password, but I don’t want random users on the internet gaining access to it without some verification that they belong.
Let me know if I can be of any further help! (Sorry I’m so long responding… I wrote this all out and thought I sent it, but I just opened up this tab again and realized I hadn’t clicked “Submit” ???♀?)