session_start() only when user is admin – displaying custom meta box errors
-
I am wondering if it is possible to only allow the session object to be created during an admin session.
I would like to avoid the overhead of sessions for regular users/site visitors.The reason I would like to use sessions for admins is, among other things, to be able to display error messages that occur in input validation within custom meta pages. Perhaps there is another way to do this – but I could not find a way to display error information in the meta box. I tried using WP_Error but could not get it to work.
By setting an error message in the session array – I can populate and display the error after trying to update custom meta box data. Then just erase the errors after I have displayed them.
I am sure that there must be a way to show errors for the custom meta box – but haven’t figured out how to do it yet. Session data seems like the only way I can get this to work for me.
Any suggestions are welcome.
The topic ‘session_start() only when user is admin – displaying custom meta box errors’ is closed to new replies.