• Resolved brewapl

    (@brewapl)


    I have a general question: for some time now, the option to disable ads for users who can write posts hasn’t been working properly on our site. I’d like to know what exactly “can write posts” means, meaning which sections of the permissions tables must be checked for a user to meet this criterion. In short, we want to disable ads for a specific group/role of users who meet the “can write posts” criterion, but we’re not sure what exactly that means.

    Here’s the capabilities connected with posts with our curent selections for the mentioned user role:

    • Delete others posts
    • Delete posts
    • Delete private posts
    • Delete published posts
    • Edit others posts
    • Edit posts – CHECKED
    • Edit private posts
    • Edit published posts
    • Manage categories
    • Moderate comments
    • Publish posts – CHECKED
    • Read private posts – CHECKED

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Adam Dunnage

    (@adamdunnage)

    Hello @brewapl, thanks for your question on the excluding users from ads who “can write posts” option. The capability that Site Kit checks for when set for a user or user role is the edit_posts capability.

    If users/user roles with this capability are still seeing ads when this setting is enabled then please could you perhaps share a screenshot or recording of this so we can see this happening?

    You can also use the following snippet to achieve this:

    The following snippet can be used too:

    add_filter( 'googlesitekit_adsense_tag_blocked' , 'restrict_adsense_snippet_role' ); function restrict_adsense_snippet_role() { // restrict ads for editors programmatically if ( current_user_can('editor')) { return true; } return false; }

    You can change this to your liking based on user roles. If you have any further questions then please let me know.

    Thread Starter brewapl

    (@brewapl)

    Thank You, Adam. Can You tell me in wich part of the site should I enter the snippet so it should work?

    I assume that I can just change the [current_user_can(‘editor‘)] with the custom-created role and that should also do the trick?

    Plugin Support Adam Dunnage

    (@adamdunnage)

    @brewapl You can add the filter to your themes functions.php file. If you’re unsure on how to do this then your hosting provider should be able to help you with this.

    Thread Starter brewapl

    (@brewapl)

    Thanks for the snippet. I used AI and managed to customise it to my needs. Also: I discovered that the problem was in the cashe plugin – it displayed the cashed version. Nevertheless – the site works better now, thank You!

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.