So I have a ton of code in my functions.php and a very large majority of it is for admin logged into wp-admin. Is there a way to make it so parts of my code will only run for admins logged into wp-admin?
Although a normal user won't see anything happening in the functions.php file. There is no need to a lot of that code to run for them at all.
Thanks in advance.
Warning! If you make any change to theme functions.php file it will break your website do not do any change unless you know what you doing.
MickeyRoush
Member
Posted 1 year ago #
Is there a way to make it so parts of my code will only run for admins logged into wp-admin?
It would be better to try a plugin. I've used one of these before in the past.
http://wordpress.org/extend/plugins/st-admin-protection/
http://wordpress.org/extend/plugins/wp-block-admin/
http://wordpress.org/extend/plugins/remove-dashboard-access-for-non-admins/
http://wordpress.org/extend/plugins/wp-hide-dashboard/
But be warned, these could cause problems with plugins and other functionalities of WordPress.