• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Simplify

Simplify

WordPress Development

  • Blog
  • Form Examples
  • Contact Us

wp_get_current_user()

Purpose

  • Retrieves the current user object.

Implementation

  • Include in
    • Plugin
    • functions.php of active theme
<?php
$current_user = wp_get_current_user();

Example of output of Object $current_user

WP_User Object
(
    [data] => stdClass Object
        (
            [ID] => 8
            [user_login] => subscriber
            [user_pass] => {Users Password}
            [user_nicename] => subscriber
            [user_email] => subscriber@sblik.com
            [user_url] => 
            [user_registered] => 2023-05-02 19:41:27
            [user_activation_key] => 
            [user_status] => 0
            [display_name] => Subscriber Sblik
        )

    [ID] => 8
    [caps] => Array
        (
            [subscriber] => 1
        )

    [cap_key] => wp_capabilities
    [roles] => Array
        (
            [0] => subscriber
        )

    [allcaps] => Array
        (
            [read] => 1
            [level_0] => 1
            [subscriber] => 1
        )

    [filter] => 
    [site_id:WP_User:private] => 1
)

Filed Under: User Functionality, WordPress Development May 2, 2023

Primary Sidebar

Categories

  • Affinipay
  • ApproveMe.com
  • Caching
  • Genesis Framework
  • Gravity Forms
  • Gravityflow
  • Gravityforms
  • HubSpot
  • Integrations
  • Javascript
  • LegalSigning
  • MemberPress
  • Oncehub
  • SiteGround Management
  • Stripe
  • Testing
  • Troubleshooting
  • Uncategorized
  • User Functionality
  • Web Development
  • WordPress Development
  • WP Webhook Pro

Footer

Design

With an emphasis on typography, white space, and mobile-optimized design, your website will look absolutely breathtaking.

Learn more about design.

Content

Our team will teach you the art of writing audience-focused content that will help you achieve the success you truly deserve.

Learn more about content.

Strategy

We help creative entrepreneurs build their digital business by focusing on three key elements of a successful online platform.

Learn more about strategy.

Copyright © 2023 · Genesis Sample on Genesis Framework · WordPress · Log in