Hello. I am trying to customize the display of some elements on the page depending on the meta field. In the “User & Role” section, no matter what I write in the dropdown list, the error “The results cannot be loaded.” always appears.
Please help me to solve this problem.
This topic was modified 2 months ago by voronov13.
This is the user’s meta field. It is added by another plugin to some users. It’s a plugin I wrote myself. Below is a sample code that changes the value of the “folder_name” field
function ufm_save_folder_name_field($user_id) { if (!current_user_can('edit_user', $user_id)) { return false; }
if (current_user_can('administrator')) { $folder_name = isset($_POST['folder_name']) ? sanitize_text_field($_POST['folder_name']) : '';
// If "Not Selected" is chosen, set $folder_name to an empty string if ($folder_name === 'Not Selected') { $folder_name = ''; }