For developers who need to customize the User Pages Add On, this page covers the filter hooks for changing the pages it creates and who can view them, helper functions for finding a member’s page, and the CSS classes you can use to style user pages.
Filters
pmpro_user_page_postdata
Filters the post data for a member’s main user page before it’s created. This runs once per member, the first time they receive a selected level. Use it to change the default title, content, slug, page template, or any other argument wp_insert_post() accepts.
apply_filters( 'pmpro_user_page_postdata', array $postdata, WP_User $user, object $level );
Parameters
$postdata: array; Arguments passed towp_insert_post(). Defaults:post_author(the member’s ID),post_content(“Pages for your purchases will be shown below.”),post_name(the member’s username),post_parent(the Top Level Page ID),post_status(publish),post_title(the member’s display name), andpost_type(page).$user: WP_User; The member the page is being created for.$level: object; The membership level the member just received.
pmpro_user_page_purchase_postdata
Filters the post data for a level page before it’s created under the member’s user page. This runs every time a member receives a selected level. Use it to set default content or a page template for level pages, or to vary them by level.
apply_filters( 'pmpro_user_page_purchase_postdata', array $postdata, WP_User $user, object $level );
Parameters
$postdata: array; Arguments passed towp_insert_post(). Defaults:post_author(the member’s ID),post_content(“Thank you for your purchase. This page will be updated soon with updates on your order.”),post_parent(the member’s user page ID),post_status(publish),post_title(the level name), andpost_type(page).$user: WP_User; The member the page is being created for.$level: object; The membership level the member just received. Use$level->idto set different content for each level.
For example code using these filters, see Setting Default Page Content or Page Template with the User Pages Add On.
pmproup_allow_access_to_user_page
Filters whether the current user can view a user page or any page nested under it. Return true to allow access or false to redirect the user to the home page. Use this to give staff, such as coaches or Editors, access to member pages on the front end.
The filter runs in two places with different defaults:
- Front end:
trueif the current user owns the page or has themanage_optionscapability. Whenfalse, the user is redirected to the home page. - REST API (requests for a single user page, such as
/wp/v2/pages/{id}, or a single media file attached to one):trueif the current user owns the page or can edit it. Whenfalse, the request returns arest_forbiddenerror.
The filter doesn’t apply to oEmbed requests. Embeds of user pages are always refused, including for the page owner.
apply_filters( 'pmproup_allow_access_to_user_page', bool $allow_access, int $page_user_id );
Parameters
$allow_access: bool; Whether to allow the current user to view the page.$page_user_id: int; The ID of the member who owns the user page, frompmproup_get_user_page_owner(). For a page below the Top Level Page that isn’t part of a member’s user page, it’s the page author’s ID, or-1if the page has no author. Except for-1, the value comes straight from the database as a numeric string, so cast it with(int)before a strict comparison.
Helper Functions
pmproup_get_page_for_user()
Returns the post ID of a member’s main user page, or null if they don’t have one or it isn’t published. Use it to link to the current member’s page from a menu, template, or shortcode.
pmproup_get_page_for_user( int|null $user_id = null );
Parameters
$user_id: int|null; The user to look up. Defaults to the current user.
pmproup_get_user_page_owner()
Returns the ID of the member who owns a user page. It checks the page and all of its ancestors, so it works for level pages and any page nested below them. If none of them is a member’s user page but the page is below your Top Level Page, it returns the page author’s ID (or -1 if the page has no author), so the page stays private. Returns null if the page isn’t part of a user page and isn’t below the Top Level Page. The page author fallback was added in version 0.7.7.
pmproup_get_user_page_owner( WP_Post $post );
Parameters
$post: WP_Post; The page to check.
CSS Classes
Use these classes in your theme or the Customizer’s Additional CSS to style user pages:
pmpro-user-page: Added to the<body>tag of every user page and every page nested under it. It is not added to the Top Level Page. Added in version 0.7.4.user_page_list: The list of level pages added below a member’s user page content, and the list of members shown to admins on the Top Level Page.pmpro_userpage_date: The date shown after each page title in the Member Links section of the Membership Account page and in the list on a member’s user page.
For example, this CSS hides the dates next to each page link:
.pmpro_userpage_date {
display: none;
}
Get Support From Our Team of Experts
Have a question about how to use this feature? Our Support Page outlines three ways to get support.
Our Max plans include hands-on help customizing your membership site and implementing new features. Upgrade to PMPro Max now »
Last updated on November 27, 2026