[OFFER ALERT!] This Halloween, Get Any Premium Theme for Just $19 [GET IT NOW]
Jump to content

[Rank Math SEO Plugin] Paywall Content (password)


Stu_Rader
 Share

Recommended Posts

Google cannot crawl some of our posts because you have to be a logged in member to see.

Crawl image - https://imgur.com/a/7aFSwB8

Google calls this "Paywall content" and you can alter the behavior in schema, but I cannot with your plugin.

Example page: https://didtheycheat.com/2016/10/11/poi-alert-male-united-states-buffalo-ny-14210/

Please read -  https://developers.google.com/search/docs/data-types/paywalled-content

Thanks for any help you can provide for us.

Stu

--

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "NewsArticle",
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://example.org/article"
  },
  "headline": "Article headline",
  "image": "https://example.org/thumbnail1.jpg",
  "datePublished": "2025-02-05T08:00:00+08:00",
  "dateModified": "2025-02-05T09:20:00+08:00",
  "author": {
    "@type": "Person",
    "name": "John Doe"
  },
  "publisher": {
     "name": "The Exemplary Times",
     "@type": "Organization",
     "logo": {
        "@type": "ImageObject",
        "url": "https://example.org/logo.jpg"
     }
  },
  "description": "A most wonderful article",
  "isAccessibleForFree": "False",
  "hasPart":
    {
    "@type": "WebPageElement",
    "isAccessibleForFree": "False",
    "cssSelector" : ".paywall"
    }
}
</script>
 

Link to comment
Share on other sites

  • Support

Hello,

Thank you for contacting MyThemeShop today.

To add paywall code in a schema, please add below filter code in your theme's functions.php file:

add_action( 'rank_math/snippet/rich_snippet_article_entity', function($entity) {
	if( is_page( 'dtc-login' ) ) { //Replace dtc-login with your page slug.
		$entity['isAccessibleForFree'] = "False";
		$entity['hasPart'] = array(
			"@type" => "WebPageElement",
	    "isAccessibleForFree" => "False",
	    "cssSelector" => ".paywall" //Replace paywall with the classname you are using to show paywall content.
		);
	}
	return $entity;
});

Hope that helps. If there is anything else, please let us know.

Thank you.


🏁Rank #1 on Google With our WordPress SEO Plugin.

Score a 💯on PageSpeed and Dominate Search Rankings.

✏ Editing theme files? Please create a child theme to make your changes update-proof.

Link to comment
Share on other sites

Thank you very much for the snippet.

 

I have put this in my child themes functions.php as instructed.

I put it in "As is" - except I changed the slug to "dtclogin" (I not sure if you interpreted "dtc-login" from our site somehow?) The login page (one of them) is in fact https://didtheycheat.com/dtclogin/

I believe I have done this correctly although if you type in /dtc-login it goes to /dtclogin the way google deciphers it, or somehow how we re-direct internally...

--

The css classname I believe are correct. BUT I am not sure about the class name as I am not using a classname to declare paywall content, you just have to be logged in to the site (joining is free).

The point is I want to make sure this is set up properly. Do I need to declare a css selector for ".paywall" ? I'm not. Other than in the code you gave me as I don't have a real paywall, just the basic registration.

I wish Google would make this easier, I thought a few years ago I could give their bot a login (maybe that was adsense). I certainly appreciate all your help from mythemeshop !!!

 

Sincerely,

Stu

Link to comment
Share on other sites

  • Support

Hello,

Yes, I used dtc-login just as an example, you should replace it with your page slug.

Regarding your second question, for Google, hasPart > cssSelector is for indicating visually hidden content behind a paywall. On your site, you're either completely removing content or showing all content publicly so the Schema is irrelevant and unnecessary in either case. It won't be necessary because cssSelector should reference the class of an element wrapping paywalled content, not just a paywall message (which is visible to all users).

The point of having this paywall schema (from Googles standpoint) stems down to one major reason:

Quote

Publishers should enclose paywalled content with structured data to help Google differentiate paywalled content from the practice of cloaking, where the content served to Googlebot is different from the content served to users.

So basically don't see any point of integrating paywall on your site since you are not hiding any content on a page for SEO gains. Please correct me if I am wrong.

Thank you.


🏁Rank #1 on Google With our WordPress SEO Plugin.

Score a 💯on PageSpeed and Dominate Search Rankings.

✏ Editing theme files? Please create a child theme to make your changes update-proof.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...