nick8 Posted December 20, 2018 Report Share Posted December 20, 2018 I tend to create my clients Analytics account under my google account. I have almost 100 of them sitting in my google account. How can I select the clients analytics account and then hide all other accounts. I don't want them to have access to the data from any of my clients analytic accounts. This is under General Setting > Search Console. Link to comment Share on other sites More sharing options...
Support Pratik.d Posted December 21, 2018 Support Report Share Posted December 21, 2018 Hello, Please use below code to remove the Search console option for everyone except the IDs in the array: // Remove Search Console option from Settings. add_filter( 'rank_math/settings/general', function( $tabs ) { $user_id = get_current_user_id(); if ( ! in_array( $user_id, array( '{COMMA_SEPARATED_CLIENT_IDS}' ) ) ) { // Eg 1,2,3 unset( $tabs['search-console'] ); } return $tabs; }); // Remove Search Console option from Setup Wizard. add_filter( 'rank_math/wizard/steps', function( $steps ) { $user_id = get_current_user_id(); if ( ! in_array( $user_id, array( '{COMMA_SEPARATED_CLIENT_IDS}' ) ) ) { // Eg 1,2,3 unset( $steps['searchconsole'] ); } return $steps; }); Hope that helps. Thank you. 🏁Rank #1 on Google With our WordPress SEO Plugin. ⚡Score a 💯on PageSpeed and Dominate Search Rankings. ✏ Editing theme files? Please create a child theme to make your changes update-proof. Link to comment Share on other sites More sharing options...
Support Pratik.d Posted December 20, 2018 Support Report Share Posted December 20, 2018 Hello, Thank you for contacting MyThemeShop and sorry for any inconvenience that might have been caused due to that. Search console profile shows all the accounts linked to the email address. Sadly, there is no way to show specific Analytics Account in Seach Console Profile. To show client specific analytics account in the profile you'll either have to create separate client accounts or you can hide the Search console option completely for specific WP users which belongs to your client by adding below code to your active theme's funcitons.php file: // Remove Search Console option from Settings. add_filter( 'rank_math/settings/general', function( $tabs ) { $user_id = get_current_user_id(); if ( in_array( $user_id, array( '{COMMA_SEPARATED_CLIENT_IDS}' ) ) ) { // Eg 1,2,3 unset( $tabs['search-console'] ); } return $tabs; }); // Remove Search Console option from Setup Wizard. add_filter( 'rank_math/wizard/steps', function( $steps ) { $user_id = get_current_user_id(); if ( in_array( $user_id, array( '{COMMA_SEPARATED_CLIENT_IDS}' ) ) ) { // Eg 1,2,3 unset( $steps['searchconsole'] ); } return $steps; }); Please replace '{COMMA_SEPARATED_CLIENT_IDS}' with the WP user IDs. Hope that helps. Thank you. 🏁Rank #1 on Google With our WordPress SEO Plugin. ⚡Score a 💯on PageSpeed and Dominate Search Rankings. ✏ Editing theme files? Please create a child theme to make your changes update-proof. Link to comment Share on other sites More sharing options...
nick8 Posted December 20, 2018 Author Report Share Posted December 20, 2018 Thanks this is great, but if they create another admin user, that user will have access. Can this be reversed so that it's removed for everyone, except the user IDs in the array? Then I'll just put my ID in there. Link to comment Share on other sites More sharing options...
Support Pratik.d Posted December 21, 2018 Support Report Share Posted December 21, 2018 Hello, Please use below code to remove the Search console option for everyone except the IDs in the array: // Remove Search Console option from Settings. add_filter( 'rank_math/settings/general', function( $tabs ) { $user_id = get_current_user_id(); if ( ! in_array( $user_id, array( '{COMMA_SEPARATED_CLIENT_IDS}' ) ) ) { // Eg 1,2,3 unset( $tabs['search-console'] ); } return $tabs; }); // Remove Search Console option from Setup Wizard. add_filter( 'rank_math/wizard/steps', function( $steps ) { $user_id = get_current_user_id(); if ( ! in_array( $user_id, array( '{COMMA_SEPARATED_CLIENT_IDS}' ) ) ) { // Eg 1,2,3 unset( $steps['searchconsole'] ); } return $steps; }); Hope that helps. Thank you. 🏁Rank #1 on Google With our WordPress SEO Plugin. ⚡Score a 💯on PageSpeed and Dominate Search Rankings. ✏ Editing theme files? Please create a child theme to make your changes update-proof. Link to comment Share on other sites More sharing options...
nick8 Posted January 2, 2019 Author Report Share Posted January 2, 2019 Thanks, that's working. Link to comment Share on other sites More sharing options...
Support Montgomerie Posted January 2, 2019 Support Report Share Posted January 2, 2019 Hello, Glad that helped. We would request you to take a couple of minutes to REVIEW the plugin and give it 5-STARS on WordPress.org, if not alreadyhttps://link.mythemeshop.com/reviewrankmath Your kind words motivate us and help us put more effort into the development of this plugin and make it even better. We really need your positive feedback to push even harder, keep the plugin FREE, and continue the development of the plugin in full-swing. If you are planning to do a 4-star review or anything less, please don't. Instead, reply here and let us understand your requirements so we can get a 5-star rating from you as well. Can not afford even a single user to be disappointed over anything. Thank you. 🏁Rank #1 on Google With our WordPress SEO Plugin ⚡Score a 💯on PageSpeed and Dominate Search Rankings. ✏ Editing theme files? Please create a child theme to make your changes update-proof. Link to comment Share on other sites More sharing options...
Recommended Posts