phpwordpress

WordPress - autor privileges issue


This is the contents of functions.php. The code displays for the admin some buttons in the editor. Why are these buttons displayed for the admin, but not displayed for the author?

function spectext_button() {
if (current_user_can('edit_posts') && current_user_can('edit_pages'))
{
    add_filter('mce_external_plugins', 'spectext_plugin');
    add_filter('mce_buttons_2', 'spectext_register_button');
}
}
add_action('init', 'spectext_button');

function spectext_plugin($plugin_array){
    $plugin_array['spectext'] = get_bloginfo('template_url').'/js/newbuttons.js';
    return $plugin_array;
}

function spectext_register_button($buttons){
    array_push($buttons, "green");
    array_push($buttons, "yellow");
    array_push($buttons, "red");
    return $buttons;
}

Solution

  • && current_user_can('edit_pages')

    The above mentioned code checks if the user has the privileges to edit pages which is allowed to only following user roles:

    If you remove this condition your buttons will work for all users capable of editing posts i.e.