admin管理员组

文章数量:1278857

I am trying to create a new member. The name of user role is Prime Members and those users should have same capabilities as customer.

I am using following code.

<?php
add_action('init', 'cloneRole');

function cloneRole()
{
    global $wp_roles;
    if ( ! isset( $wp_roles ) )
        $wp_roles = new WP_Roles();

    $adm = $wp_roles->get_role('customer');
    //Adding a 'new_role' with all admin caps
    $wp_roles->add_role('prime_members', 'Prime Members', $adm->capabilities);
}
?>

When I click on update file button an error shows

Your PHP code changes were rolled back due to an error on line 644 of file C:\xampp\htdocs\wordpress\wp-content\themes\twentytwentyone\functions.php. Please fix and try saving again.

syntax error, unexpected token "<", expecting end of file

本文标签: Error while creating a clone role in wordpress