{"id":4004,"date":"2020-06-25T09:59:01","date_gmt":"2020-06-25T13:59:01","guid":{"rendered":"https:\/\/themespress.ca\/?p=4004"},"modified":"2021-11-16T21:24:25","modified_gmt":"2021-11-17T02:24:25","slug":"how-to-display-wordpress-users-id","status":"publish","type":"post","link":"https:\/\/themespress.ca\/en\/how-to-display-wordpress-users-id\/","title":{"rendered":"How to Display WordPress User&#8217;s ID"},"content":{"rendered":"<div class=\"wpb-content-wrapper\"><div class=\"vc_row wpb_row vc_row-fluid\"><div class=\"wpb_column vc_column_container vc_col-sm-12\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\">\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>In this tutorial, we will configure a function that will allow us to display WordPress admin users&#8217; IDs. We will use the following filter:  <a href=\"https:\/\/developer.wordpress.org\/reference\/hooks\/manage_users_custom_column\/\" target=\"_blank\" rel=\"noopener noreferrer\">manage_users_custom_column<\/a><\/p>\n\n\t\t<\/div>\n\t<\/div>\n<div id=\"ts-enlighterjs-container-8623139\" class=\"ts-enlighterjs-container-single-enabled  \" style=\"width: 100%;  margin-top: 0px; margin-bottom: 0px;\" data-enlighter-doubleclick=\"true\" data-enlighter-windowbutton=\"true\" data-enlighter-windowtext=\"New Window\" data-enlighter-rawbutton=\"true\" data-enlighter-rawtext=\"RAW Code\" data-enlighter-infobutton=\"false\" data-enlighter-infotext=\"EnlighterJS\" data-enlighter-indent=\"2\"><pre id=\"ts-enlighterjs-pre-8623139\" class=\"\" style=\"white-space: pre-wrap; height: 100%; margin: 0; padding: 0;\" data-enlighter-language=\"php\" data-enlighter-theme=\"custom\" data-enlighter-group=\"\" data-enlighter-title=\"\" data-enlighter-linenumbers=\"true\" data-enlighter-lineoffset=\"1\" data-enlighter-highlight=\"\">function addo_custom_add_user_id_column($columns) {\n    $columns[&#039;user_id&#039;] = &#039;User ID&#039;;\n    return $columns;\n}\nadd_filter(&#039;manage_users_columns&#039;, &#039;addo_custom_add_user_id_column&#039;);\n\/\/Adds Content To The Custom Added Column\nfunction addo_show_user_id_column_content($value, $column_name, $user_id) {\n    $user = get_userdata( $user_id );\n    if ( &#039;user_id&#039; == $column_name )\n        return $user_id;\n    return $value;\n}\nadd_filter(&#039;manage_users_custom_column&#039;,  &#039;addo_show_user_id_column_content&#039;, 10, 3);<\/pre><\/div>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>After configuring this filter, you can also use <a href=\"https:\/\/developer.wordpress.org\/reference\/hooks\/pre_get_users\/\" target=\"_blank\" rel=\"noopener noreferrer\">pre_get_users<\/a> in order to sort the users&#8217; IDs. <strong><a href=\"https:\/\/themespress.ca\/utilisateurs-wordpress-trier-en-ordre-par-id\/\" target=\"_blank\" rel=\"noopener noreferrer\">WordPress users: Sort by ID<\/a><\/strong><\/p>\n\n\t\t<\/div>\n\t<\/div>\n<\/div><\/div><\/div><\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"In this tutorial, we will configure a function that will allow us to display Wordpress admin users' IDs. We will use the following filter: manage_users_custom_column function addo_custom_add_user_id_column($columns) { $columns[&#039;user_id&#039;] =<div class=\"read-more\"><a class=\"btn button-secondary\" href=\"https:\/\/themespress.ca\/en\/how-to-display-wordpress-users-id\/\">Read More<\/a><\/div>","protected":false},"author":81,"featured_media":4912,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[283],"tags":[332,326],"class_list":["post-4004","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-body","tag-users"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/posts\/4004","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/users\/81"}],"replies":[{"embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/comments?post=4004"}],"version-history":[{"count":0,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/posts\/4004\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/media\/4912"}],"wp:attachment":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/media?parent=4004"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/categories?post=4004"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/tags?post=4004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}