• Is there anything I could add to my functions.php file to allow an editor of a site to be able to ‘flush or purge the cache’?

    Or as an alternative question, to reach the same goal…
    I am using the plugin Capability Manager Enhanced
    And on this support thread (https://wordpress.org/support/topic/permission-per-plugin?replies=2), the answer given sums up what we need to know:

    That would depend entirely on the other plugin code. Capability Manager Enhanced can add or remove capabilities from WordPress role definitions. In other words, it lets you turn switches on or off. The wiring of those switches into actual website behavior depends on the code in WordPress or (in this case) other plugins. If the other plugin supports a custom capability, you can add that to roles using CME.

    Any guidance would be appreciated, thanks.

    https://wordpress.org/plugins/sg-cachepress/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Hristo Pandjarov

    (@hristo-sg)

    SiteGround Representative

    No, only admins can flush the cache now. I will ad an option to choose the level of privilleges necessary for purge in the next versions.

    Hi, an option to let the editor role purge the cache would be really nice. Is this already working? Or do you have a custom link I can manually add to the wordpress admin bar so user can purge the cache?
    Thank you for your help.

    Hi,

    Maybe it’s better if it stays the way it is.
    If you want a purge sg cache for editor role, put this inside your functions.php file of your child theme:

    add_action( 'admin_bar_menu', 'add_admin_bar_purge_editor' );
    function add_admin_bar_purge_editor ( $wp_admin_bar ){
    		$args = array(
    				'id'    => 'SG_CachePress_Supercacher_Purge',
    				'title' => __('Refresh website','sg-cachepress'),
    				'href'  => wp_nonce_url( admin_url( 'admin-post.php?action=sg-cachepress-purge' ),'sg-cachepress-purge' ),
    				'meta'  => array( 'class' => 'sg-cachepress-admin-bar-purge' )
    		);
    		if ( current_user_can('delete_pages') ) {
    			$wp_admin_bar->add_node( $args );
    		}
    	}
    Plugin Author Hristo Pandjarov

    (@hristo-sg)

    SiteGround Representative

    I am thinking about adding an option to select the minimum role level required to be able to purge the cache and access the configuration panel.

    Good idea. Please also include an option (or code snippet) to change the text of Purge SG Cache in the front end admin bar. None of my clients understands what this is :). They do understand refresh website or something like that. Also some people want this text in a different language for the clients.

    Plugin Author Hristo Pandjarov

    (@hristo-sg)

    SiteGround Representative

    The plugin is fully translatable, if they change the WordPress language to supported one, the text will change.

    +1 on editors being able to clear the cache.

    Is there an action that can be hooked to purge the cache? In the meantime, it would be nice to be able to clear the cache using a custom option.

    Plugin Author Hristo Pandjarov

    (@hristo-sg)

    SiteGround Representative

    That’s on the list of thins we plan on adding in the next releases!

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

The topic ‘Allow 'Editor' to flush/purge cache’ is closed to new replies.