Reputation: 25
I'm using the WordPress plugin "restrict content pro".
I would like to hide an element with selector li#wp-admin-bar-my-account-messages
for a specific subscription id with PHP within my functions.php file.
I guess the PHP validation is rcp_is_active() && rcp_get_subscription_id() == 2
but don't know how to go on from here.
Thanks in advance
Upvotes: 1
Views: 356
Reputation: 3323
Assuming that rcp_is_active() && rcp_get_subscription_id() == 2
will validate to your specific use case and you just want to hide the element which has selector li#wp-admin-bar-my-account-messages
you can do the following in your function.php
if ( rcp_is_active() && rcp_get_subscription_id() == 2 )
{
// for frontend
add_action( 'wp_head', function() {
echo '<style type="text/css">li#wp-admin-bar-my-account-messages{display:none !important}</style>';
} );
// for backend
add_action( 'admin_head', function() {
echo '<style type="text/css">li#wp-admin-bar-my-account-messages{display:none !important}</style>';
} );
}
Hope it helps :)
Upvotes: 1