Hi @shouldvelearnedit
Please try adding the following code snippets to your site. You can add it to your theme/child-theme’s functions.php file or use the Code Snippets plugin to run the code:
/**
* Customize WP_Post object for the restricted post (if it's not hidden) in the archive page
*
* @param WP_Post $post
* @param array $restriction_settings
* @param WP_Post $original_post
*
* @return WP_Post
*/
function um_custom_data_restricted_archive_post( $post, $restriction_settings, $original_post ) {
// if you want to show the original post title instead of the restriction content title
// use these object keys https://developer.www.ads-software.com/reference/functions/get_post/#comment-876
$post->post_title = $original_post->post_title;
// sometimes $original_post is already customized then please use this way
$p = get_post( $original_post->ID );
$post->post_title = $p->post_title;
$post->post_excerpt = $p->post_excerpt;
return $post;
}
add_filter( 'um_restricted_archive_post', 'um_custom_data_restricted_archive_post', 10, 3 );
/**
* Customize WP_Post object for the restricted post (if it's not hidden) in the singular post's page
*
* @param WP_Post $post
* @param array $restriction_settings
* @param WP_Post $original_post
*
* @return WP_Post
*/
function um_custom_data_restricted_singular_post( $post, $restriction_settings, $original_post ) {
// if you want to show the original post title instead of the restriction content title
// use these object keys https://developer.www.ads-software.com/reference/functions/get_post/#comment-876
$post->post_title = $original_post->post_title;
// sometimes $original_post is already customized then please use this way
$p = get_post( $original_post->ID );
$post->post_title = $p->post_title;
$post->post_excerpt = $p->post_excerpt;
return $post;
}
add_filter( 'um_restricted_singular_post', 'um_custom_data_restricted_singular_post', 10, 3 );
// avoid changing the post title to the "restricted content title"
add_filter( 'um_ignore_restricted_title', '__return_true' );
Regards,