Hide attribute from logged out user

i want to hide mobile number from logged out user, and display login link, after logged in redirect to same page.

this code i have used for hide attribute from logged out users

	function( $attributes ) {
		if ( isset( $attributes['attribute_name'] ) && !is_user_logged_in() ) {
			$attributes['attribute_name']['display_format'] = 'Login to view';
		return $attributes;

now how to show custom link and redirect to the same page?

1 Like


Sorry for the inconvenience, but customization is beyond our support scope - it includes fixing bugs and guidance about the available features Support Policy | HivePress

If customizations are required for your site, please try customizing it using the collection of code snippets Search · user:hivepress · GitHub and other developer resources, or consider hiring someone for custom work https://fvrr.co/32e7LvY

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.