How do I add a Membership Expiry view-only field to a user profile page in Wordpress?
If you want to fetch this information directly, the following code should get you started. It displays the logged-in user's membership expiry date:

// get current WP user
$user = wp_get_current_user();

if ( civi_wp()-&gt;initialize() ) {

    // get contact ID
    require_once 'CRM/Core/BAO/UFMatch.php';
    $civi_contact_id = CRM_Core_BAO_UFMatch::getContactId( $user-&gt;ID );

    // get CiviCRM membership details
    $memberships = civicrm_api( 'Membership', 'get', array(
        'version' =&gt; '3',
        'page' =&gt; 'CiviCRM',
        'q' =&gt; 'civicrm/ajax/rest',
        'sequential' =&gt; '1',
        'contact_id' =&gt; $civi_contact_id,
    ));

    // show expiry date
    echo $memberships['values'][0]['end_date'];

}


Obviously your production code would include error checks after fetching the CiviCRM Contact ID and the Memberships that they may or may not hold. It would also convert the date to a more friendly format.