$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>underscore not allowed in role slug?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

underscore not allowed in role slug?

matteradmin6PV0评论

I created a role, 'CFI_G' in a plugin activator:

if(!role_exists('cfi_g')){ add_role('cfi_g' , 'CFI-G',
array('edit_gc_instruction')); } else {

(note the underscore in the slug)

It appeared to all go correctly and I have assigned several users to that role. However I need to loop through all roles in the site to create a select list, so I used $wp_roles:

$all_roles = $wp_roles->roles;
$editable_roles = apply_filters('editable_roles', $all_roles);

The CFI-G role does not appear in $editable_roles. However I tried adding the role of "CFI-G" using the MEMBERS plugin which created it with the slug "cfi-g". Now both the new cfi-g and the cfi_g roles appear in $editable_roles. If I delete the 'cfi-g' role, 'cfi_g' again disappears from $editable_roles.

Is an underscore NOT to be used in slugs? is there a way I can keep 'cfi_g'? Might this possibly be a bug?

thanks

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far