Term rules oddity | WordPress.org

[ad_1]

I don’t think “is_post_type” is working correctly for term restrictions.

Consider the following pair of restrictions:

  • 1 Internal Pages
    • General: Logged in users
    • Protection: Redirect
    • Content: “Content is Page” AND “Content is Not Home Page”
  • 2 Term
    • General: Logged in users of a role, say “Author”
    • Protection: Redirect
    • Content: “Content is selected Tag = xxx”

I have a page that triggers a query involving a post_tags. When I’m logged in as a role other than “Author” I would expect the Tag xxx to be removed from the query – because of restriction 2. However, restriction 2 never gets tested. The query matches against restriction 1!

When “content_is_post_type” for “page” is called to test first part of restriction 1 for context “terms” it goes through the default branch which calls is_post_type which succeeds.

I think the switch in “content_is_post_type” needs the following additional case statement:

case 'terms':
return false;

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer