3

with the plugin w3-total cache, in the overview of wordpress-posts there is the ability to "Purge from Page Cache" for each post.

this function is also available for users of the role "author". this is nothing to worry about if this were possible only on their own posts. but as an "author" you can do this also on other users posts .

so, is there a way to configure w3tc to not allow this for specific user-groups?

uzed_creative
  • 65
  • 1
  • 4
  • Are you sure "author" can actually purge? when i tested it, i got "not enough privileges" error on http://site.com/wp-admin/admin.php?page=w3tc_general&w3tc_pgcache_purge_post – Łukasz Rysiak Apr 16 '12 at 23:42
  • Would love to hide this too - it's awkward having a complex UI element for low-level users and if they do click it they get a permission error. – Adam Pope Sep 03 '12 at 09:06

1 Answers1

0

This removes the link for all roles, put it in functions.php

function remove_purge_from_page_cache_link($actions, $post){
  unset($actions['pgcache_purge']);

  return $actions;
}

add_filter('post_row_actions', 'remove_purge_from_page_cache_link',1000,2);
add_filter('page_row_actions', 'remove_purge_from_page_cache_link',1000,2);

To make it only remove for authors you'll want to use something like this

if (!current_user_can('publish_posts')) {
    unset($actions['pgcache_purge']);
}

You can tweak the logic to target the user group(s) you want.

Adam Pope
  • 3,234
  • 23
  • 32